File tree 2 files changed +19
-15
lines changed
2 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export class SidebarNavLinkComponent implements OnInit, OnDestroy {
85
85
this . url =
86
86
typeof this . item . url === 'string'
87
87
? this . item . url
88
- : this . router . serializeUrl ( this . router . createUrlTree ( this . item . url as any [ ] ) ) ;
88
+ : this . router . serializeUrl ( this . router . createUrlTree ( ( this . item . url as any [ ] ) ?? [ '' ] ) ) ;
89
89
this . linkType = this . getLinkType ( ) ;
90
90
this . href = this . isDisabled ( ) ? '' : this . item . href || this . url ;
91
91
this . linkActive = this . router . url . split ( / [ ? # ( ; ] / ) [ 0 ] === this . href . split ( / [ ? # ( ; ] / ) [ 0 ] ;
@@ -110,7 +110,7 @@ export class SidebarNavLinkComponent implements OnInit, OnDestroy {
110
110
111
111
public isExternalLink ( ) : boolean {
112
112
const linkPath = Array . isArray ( this . item . url ) ? this . item . url [ 0 ] : this . item . url ;
113
- return ! ! this . item . href || linkPath . substring ( 0 , 4 ) === 'http' ;
113
+ return ! ! this . item . href || linkPath ? .substring ( 0 , 4 ) === 'http' ;
114
114
}
115
115
116
116
linkClicked ( ) : void {
Original file line number Diff line number Diff line change @@ -160,22 +160,26 @@ export class SidebarNavGroupComponent implements OnInit, OnDestroy {
160
160
161
161
onAnimationStart ( $event : AnimationEvent ) {
162
162
this . display = { display : 'block' } ;
163
- if ( $event . toState === 'open' ) {
164
- const host = this . sidebarNav . nativeElement ;
165
- this . renderer . setStyle ( host , 'height' , `${ host [ 'scrollHeight' ] } px` ) ;
166
- }
163
+ setTimeout ( ( ) => {
164
+ const host = this . sidebarNav ?. nativeElement ;
165
+ if ( $event . toState === 'open' && host ) {
166
+ this . renderer . setStyle ( host , 'height' , `${ host [ 'scrollHeight' ] } px` ) ;
167
+ }
168
+ } ) ;
167
169
}
168
170
169
171
onAnimationDone ( $event : AnimationEvent ) {
170
- if ( $event . toState === 'open' ) {
171
- const host = this . sidebarNav . nativeElement ;
172
- this . renderer . setStyle ( host , 'height' , 'auto' ) ;
173
- }
174
- if ( $event . toState === 'closed' ) {
175
- setTimeout ( ( ) => {
176
- this . display = null ;
177
- } ) ;
178
- }
172
+ setTimeout ( ( ) => {
173
+ const host = this . sidebarNav ?. nativeElement ;
174
+ if ( $event . toState === 'open' && host ) {
175
+ this . renderer . setStyle ( host , 'height' , 'auto' ) ;
176
+ }
177
+ if ( $event . toState === 'closed' ) {
178
+ setTimeout ( ( ) => {
179
+ this . display = null ;
180
+ } ) ;
181
+ }
182
+ } ) ;
179
183
}
180
184
}
181
185
You can’t perform that action at this time.
0 commit comments