fuse-angular/src/app/core/components/navigation/navigation.service.ts
Sercan Yemen 2f4ce6221e horizontal navigation layout
+ added boxed layout option
+ added a close overlay to theme options
+ moved the buy button to the footer
+ added fade-in-out animation
+ File Manager app min row height
2017-09-11 12:30:01 +03:00

65 lines
1.4 KiB
TypeScript

import { EventEmitter, Injectable } from '@angular/core';
import { FuseNavigation } from '../../../navigation.model';
@Injectable()
export class FuseNavigationService
{
onNavCollapseToggled = new EventEmitter<any>();
navigation: FuseNavigation;
flatNavigation: any[] = [];
constructor()
{
this.navigation = new FuseNavigation();
}
/**
* Get navigation array
* @returns {any[]}
*/
getNavigation(item)
{
return this.navigation[item];
}
/**
* Get flattened navigation array
* @param navigationItems
* @returns {any[]}
*/
getFlatNavigation(navigationItems?)
{
if ( !navigationItems )
{
navigationItems = this.navigation;
}
for ( const navItem of navigationItems )
{
if ( navItem.type === 'subheader' )
{
continue;
}
if ( navItem.type === 'nav-item' )
{
this.flatNavigation.push({
title: navItem.title,
type : navItem.type,
icon : navItem.icon || false,
url : navItem.url
});
continue;
}
if ( navItem.type === 'nav-collapse' )
{
this.getFlatNavigation(navItem.children);
}
}
return this.flatNavigation;
}
}