-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathenvironment.ts
More file actions
56 lines (44 loc) · 1.21 KB
/
Copy pathenvironment.ts
File metadata and controls
56 lines (44 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Angular 2
// rc2 workaround
import {enableDebugTools, disableDebugTools} from "@angular/platform-browser";
import {enableProdMode, ApplicationRef} from "@angular/core";
// Environment Providers
let PROVIDERS: any[] = [
// common env directives
];
// Angular debug tools in the dev console
// https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md
let _decorateModuleRef = function identity<T>(value: T): T {
return value;
};
if ('production' === ENV) {
// Production
enableProdMode();
_decorateModuleRef = (modRef: any) => {
disableDebugTools();
return modRef;
};
PROVIDERS = [
...PROVIDERS,
// custom providers in production
];
} else {
_decorateModuleRef = (modRef: any) => {
const appRef = modRef.injector.get(ApplicationRef);
const cmpRef = appRef.components[0];
let _ng = (<any>window).ng;
enableDebugTools(cmpRef);
(<any>window).ng.probe = _ng.probe;
(<any>window).ng.coreTokens = _ng.coreTokens;
return modRef;
};
// Development
PROVIDERS = [
...PROVIDERS,
// custom providers in development
];
}
export const decorateModuleRef = _decorateModuleRef;
export const ENV_PROVIDERS = [
...PROVIDERS
];