Skip to content

Instantly share code, notes, and snippets.

@ypcode
Last active Jul 29, 2018
Embed
What would you like to do?
public onInit(): Promise<any> {
return (
super
.onInit()
// Set the global configuration of the application
// This is where we will define the proper services according to the context (Local, Test, Prod,...)
// or according to specific settings
.then(() => {
let scope = this.context.serviceScope;
return new Promise((resolve, reject) => {
if (this.properties.config) {
switch (this.properties.config) {
case 'config2':
let childScope = scope.startNewChild();
childScope.createAndProvide(GreetingsServiceKey, AltGreetingsService);
childScope.finish();
usedScope = childScope;
break;
case 'config1':
default:
break;
}
}
scope.whenFinished(() => {
resolve();
});
});
})
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment