mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-10 12:35:07 +00:00
(Config Service) Added ability to access to the default config and reset to it
This commit is contained in:
parent
02f305be1f
commit
9635165316
|
@ -59,6 +59,16 @@ export class FuseConfigService
|
||||||
return this._configSubject.asObservable();
|
return this._configSubject.asObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default config
|
||||||
|
*
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
get defaultConfig(): any
|
||||||
|
{
|
||||||
|
return this._defaultConfig;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
// @ Private methods
|
// @ Private methods
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
@ -78,11 +88,11 @@ export class FuseConfigService
|
||||||
this._defaultConfig.customScrollbars = false;
|
this._defaultConfig.customScrollbars = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the settings from the default settings
|
// Set the config from the default config
|
||||||
this._configSubject = new BehaviorSubject(_.cloneDeep(this._defaultConfig));
|
this._configSubject = new BehaviorSubject(_.cloneDeep(this._defaultConfig));
|
||||||
|
|
||||||
// Reload the default settings on every navigation start if
|
// Reload the default config on every navigation start if
|
||||||
// the current settings are different from defaults
|
// the current config is different from the default one
|
||||||
this._router.events
|
this._router.events
|
||||||
.pipe(filter(event => event instanceof NavigationStart))
|
.pipe(filter(event => event instanceof NavigationStart))
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
|
@ -92,5 +102,18 @@ export class FuseConfigService
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset to the default config
|
||||||
|
*/
|
||||||
|
resetToDefaults(): void
|
||||||
|
{
|
||||||
|
// Set the config from the default config
|
||||||
|
this._configSubject.next(_.cloneDeep(this._defaultConfig));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user