diff options
Diffstat (limited to 'client/src/app/environment.ts')
-rw-r--r-- | client/src/app/environment.ts | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/client/src/app/environment.ts b/client/src/app/environment.ts new file mode 100644 index 000000000..8bba89c4e --- /dev/null +++ b/client/src/app/environment.ts | |||
@@ -0,0 +1,50 @@ | |||
1 | |||
2 | // Angular 2 | ||
3 | // rc2 workaround | ||
4 | import { enableDebugTools, disableDebugTools } from '@angular/platform-browser'; | ||
5 | import { enableProdMode, ApplicationRef } from '@angular/core'; | ||
6 | // Environment Providers | ||
7 | let PROVIDERS = [ | ||
8 | // common env directives | ||
9 | ]; | ||
10 | |||
11 | // Angular debug tools in the dev console | ||
12 | // https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md | ||
13 | let _decorateModuleRef = function identity(value) { return value; }; | ||
14 | |||
15 | if ('production' === ENV) { | ||
16 | // Production | ||
17 | disableDebugTools(); | ||
18 | enableProdMode(); | ||
19 | |||
20 | PROVIDERS = [ | ||
21 | ...PROVIDERS, | ||
22 | // custom providers in production | ||
23 | ]; | ||
24 | |||
25 | } else { | ||
26 | |||
27 | _decorateModuleRef = (modRef: any) => { | ||
28 | const appRef = modRef.injector.get(ApplicationRef); | ||
29 | const cmpRef = appRef.components[0]; | ||
30 | |||
31 | let _ng = (<any>window).ng; | ||
32 | enableDebugTools(cmpRef); | ||
33 | (<any>window).ng.probe = _ng.probe; | ||
34 | (<any>window).ng.coreTokens = _ng.coreTokens; | ||
35 | return modRef; | ||
36 | }; | ||
37 | |||
38 | // Development | ||
39 | PROVIDERS = [ | ||
40 | ...PROVIDERS, | ||
41 | // custom providers in development | ||
42 | ]; | ||
43 | |||
44 | } | ||
45 | |||
46 | export const decorateModuleRef = _decorateModuleRef; | ||
47 | |||
48 | export const ENV_PROVIDERS = [ | ||
49 | ...PROVIDERS | ||
50 | ]; | ||