mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-10 04:25:08 +00:00
Warn the user about the missing sidebars in registry
+ Check if the sidebar exists before trying to close it
This commit is contained in:
parent
44663342f4
commit
5c66d95951
|
@ -46,7 +46,7 @@ export class FuseSidebarService
|
|||
// Check if the sidebar exists
|
||||
if ( !this._registry[key] )
|
||||
{
|
||||
console.error(`The sidebar with the key '${key}' doesn't exist in the registry.`);
|
||||
console.warn(`The sidebar with the key '${key}' doesn't exist in the registry.`);
|
||||
}
|
||||
|
||||
// Unregister the sidebar
|
||||
|
@ -57,13 +57,14 @@ export class FuseSidebarService
|
|||
* Return the sidebar with the given key
|
||||
*
|
||||
* @param key
|
||||
* @returns {FuseSidebarComponent}
|
||||
*/
|
||||
getSidebar(key): FuseSidebarComponent
|
||||
{
|
||||
// Check if the sidebar exists
|
||||
if ( !this._registry[key] )
|
||||
{
|
||||
console.error(`The sidebar with the key '${key}' doesn't exist in the registry.`);
|
||||
console.warn(`The sidebar with the key '${key}' doesn't exist in the registry.`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import { FuseSidebarService } from '@fuse/components/sidebar/sidebar.service';
|
|||
|
||||
import { navigation } from 'app/navigation/navigation';
|
||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||
import { FuseSidebarComponent } from '@fuse/components/sidebar/sidebar.component';
|
||||
|
||||
@Component({
|
||||
selector : 'fuse-navbar',
|
||||
|
@ -58,10 +59,13 @@ export class FuseNavbarComponent implements OnInit, OnDestroy
|
|||
this.router.events.subscribe(
|
||||
(event) => {
|
||||
if ( event instanceof NavigationEnd )
|
||||
{
|
||||
if ( this.sidebarService.getSidebar('navbar') )
|
||||
{
|
||||
this.sidebarService.getSidebar('navbar').close();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user