Project configuration

Project config data, includes App, Layout, User, three data types And store persistence in localStorage (Please refer to #1737 to switch to sessionStorage).

Suggest: Call the setApp(), setUser() methods to restore project config data, via Angular startup service (startup.service.ts).

API

SettingsService

NameTypeReturn ValueDescription
layoutpropertyLayoutData of layout
apppropertyAppData of app
userpropertyUserData of User
notifypropertyObservable<SettingsNotify>Notify when layout, app, user information changes
setLayout(name: string, value: any)methodbooleanSet property value of layout
setApp(value: App)methodbooleanSet app data
setUser(value: User)methodbooleanSet user data

App

PropertyDescriptionTypeDefault
[name]Name for appstring-
[description]Description for appstring-

User

PropertyDescriptionTypeDefault
[name]Name for current userstring-
[avatar]Avatar for current userstring-
[email]Email for current userstring-

Layout

PropertyDescriptionTypeDefault
[collapsed]Whether to fold menuboolean-
[lang]Current languagestring-
[colorWeak]Color weakbooleanfalse

FAQ

How to change the local storage key name?

Support add the configuration of ALAIN_SETTING_KEYS via the global-config.module.ts global configuration file, for example:

 const alainProvides = [
  { provide: ALAIN_CONFIG, useValue: alainConfig },
+ {
+   provide: ALAIN_SETTING_KEYS,
+   useValue: {
+     layout: 'new-layout',
+     user: 'new-user',
+     app: 'new-app',
+   },
+ },
];