fuse-angular/src/app/core/services/config.service.ts
mustafahlvc f1ac166ca6 Roter Animation:
+ animations disabled for child queries (eg. Mail App)
+ New router animations added
+ Router animation option added to config and theme options
+ Disabled delaying fakedb requests
2017-08-23 17:28:15 +03:00

72 lines
1.9 KiB
TypeScript

import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { NavigationStart, Router } from '@angular/router';
import { Platform } from '@angular/cdk';
@Injectable()
export class FuseConfigService
{
settings: any;
defaultSettings: any;
onSettingsChanged: BehaviorSubject<any>;
/**
* @param router
*/
constructor(
private router: Router,
public platform: Platform
)
{
// Set the default settings
this.defaultSettings = {
layout : {
navigation: 'left', // 'right', 'left', 'top', none
toolbar : 'below', // 'above', 'below', none
footer : 'none' // 'above', 'below', none
},
colorClasses : {
toolbar: 'md-white-500-bg',
navbar : 'md-fuse-dark-500-bg',
footer : 'md-fuse-dark-800-bg'
},
customScrollbars: true,
routerAnimation : 'fadeIn'
};
/**
* Disable Custom Scrollbars if Browser is Mobile
*/
if ( this.platform.ANDROID || this.platform.IOS )
{
this.defaultSettings.customScrollbars = false;
}
this.settings = Object.assign({}, this.defaultSettings);
// Reload the default settings on every navigation start
router.events.subscribe(
(event) => {
if ( event instanceof NavigationStart )
{
this.setSettings({layout: this.defaultSettings.layout});
}
}
);
// Create the behavior subject
this.onSettingsChanged = new BehaviorSubject(this.settings);
}
/**
* Sets settings
* @param settings
*/
setSettings(settings)
{
this.settings = Object.assign({}, this.settings, settings);
this.onSettingsChanged.next(this.settings);
}
}