ci-cd
CI/CD
angular-cli
hot replace
在 app.module
通过 DoBootstrap
钩子,加载环境变量
@NgModule({
declarations: [AppComponent],
//...
entryComponents: [AppComponent]
})
export class AppModule implements DoBootstrap {
ngDoBootstrap(appRef: ApplicationRef) {
fetch('assets/config/environment.json', {
method: 'GET'
})
.then(next => next.json())
.then(next => (environment.application = next))
.then(next =>
// ...
appRef.bootstrap(AppComponent);
);
}
}