Trigger expand/collapse of the navigation on ngOnInit to update the active item

This commit is contained in:
Sercan Yemen 2017-11-30 10:37:35 +03:00
parent 2bbc90af64
commit 0d8fe0be72

View File

@ -69,6 +69,20 @@ export class FuseNavVerticalCollapseComponent implements OnInit
); );
} }
ngOnInit()
{
// Check if the url can be found in
// one of the children of this item
if ( this.isUrlInChildren(this.item, this.router.url) )
{
this.expand();
}
else
{
this.collapse();
}
}
/** /**
* Toggle collapse * Toggle collapse
* *
@ -108,6 +122,7 @@ export class FuseNavVerticalCollapseComponent implements OnInit
{ {
return; return;
} }
this.isOpen = false; this.isOpen = false;
this.navigationService.onNavCollapseToggle.emit(); this.navigationService.onNavCollapseToggle.emit();
} }
@ -175,8 +190,4 @@ export class FuseNavVerticalCollapseComponent implements OnInit
return false; return false;
} }
ngOnInit()
{
}
} }