fuse-angular/src/@fuse/components/navigation/navigation.service.ts
Sercan Yemen 3dfb79423a Changed how navigation data passed into the fuse-navigation
+ Added hidden property to the nav items
+ Updated fuse-navigation component docs
+ Updated other components that uses fuse-navigation service
+ Updated various packages including Angular and Angular Material
2018-02-20 11:05:07 +03:00

49 lines
1.1 KiB
TypeScript

import { EventEmitter, Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
@Injectable()
export class FuseNavigationService
{
flatNavigation: any[] = [];
onItemCollapsed: Subject<any> = new Subject;
onItemCollapseToggled: Subject<any> = new Subject;
constructor()
{
}
/**
* Get flattened navigation array
* @param navigation
* @returns {any[]}
*/
getFlatNavigation(navigation)
{
for ( const navItem of navigation )
{
if ( navItem.type === 'item' )
{
this.flatNavigation.push({
title: navItem.title,
type : navItem.type,
icon : navItem.icon || false,
url : navItem.url
});
continue;
}
if ( navItem.type === 'collapse' || navItem.type === 'group' )
{
if ( navItem.children )
{
this.getFlatNavigation(navItem.children);
}
}
}
return this.flatNavigation;
}
}