Open tobigit opened 7 years ago
I didn't test this, but something along the lines of the following should work.
import { LocalStorageService } from 'angular-2-local-storage';
export let localStorageConfigFactory = () => {
return {
prefix: `my-app-${window.ownVariables.var1}`,
storageType: 'localStorage'
}
}
export let localStorageConfigProvider = {
provide: 'LOCAL_STORAGE_SERVICE_CONFIG',
useFactory: localStorageConfigFactory
};
@NgModule({
imports: [],
declarations: [],
providers: [
localStorageConfigProvider,
LocalStorageService //not required if the service is made 'shakeable'
],
bootstrap: [AppComponent]
})
export class AppModule {}
Thanx for this great plugin!
I have a question. I am using angular 4.3.5 with angular cli 1.3.2 and compile my code with aot enabled. How can i use a variable stored in global window-variable for prefix?
The variable myVaraible is undefined at compile time of aot. Do you have any ideas to solve this problem? Is there a possibility to set the prefix in another way?