Skip to content

Commit a494333

Browse files
committed
feat(prod-build): add environment config
1 parent e201fc5 commit a494333

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import {bootstrap} from 'angular2/platform/browser';
2+
import {provide} from 'angular2/core';
3+
import {Environment} from './app/environment';
24
import {<%= jsComponentName %>App} from './app/<%= htmlComponentName %>';
35

4-
bootstrap(<%= jsComponentName %>App, []);
6+
bootstrap(<%= jsComponentName %>App,
7+
[provide(Environment, { useValue: new Environment() })]);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environmentConfig = {
2+
production: false,
3+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {enableProdMode} from 'angular2/core';
2+
import {environmentConfig} from './environment.config';
3+
4+
export class Environment {
5+
config = environmentConfig;
6+
constructor() {
7+
if (this.config.production) {
8+
enableProdMode();
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)