ngx-admin/src/platform/environment.ts

48 lines
1 KiB
TypeScript
Raw Normal View History

2016-04-20 16:32:12 +03:00
// Angular 2
2016-06-29 11:54:16 +03:00
// rc2 workaround
import { enableDebugTools, disableDebugTools } from '@angular/platform-browser';
import { enableProdMode } from '@angular/core';
2016-04-20 16:32:12 +03:00
// Environment Providers
2016-06-29 11:54:16 +03:00
let PROVIDERS = [
// common env directives
];
// Angular debug tools in the dev console
// https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md
let _decorateComponentRef = function identity(value) { return value; };
2016-04-20 16:32:12 +03:00
if ('production' === ENV) {
// Production
2016-06-29 11:54:16 +03:00
disableDebugTools();
2016-04-20 16:32:12 +03:00
enableProdMode();
PROVIDERS = [
2016-06-29 11:54:16 +03:00
...PROVIDERS,
// custom providers in production
2016-04-20 16:32:12 +03:00
];
} else {
2016-06-29 11:54:16 +03:00
_decorateComponentRef = (cmpRef) => {
let _ng = (<any>window).ng;
enableDebugTools(cmpRef);
(<any>window).ng.probe = _ng.probe;
(<any>window).ng.coreTokens = _ng.coreTokens;
return cmpRef;
};
2016-06-29 11:54:16 +03:00
2016-04-20 16:32:12 +03:00
// Development
PROVIDERS = [
2016-06-29 11:54:16 +03:00
...PROVIDERS,
// custom providers in development
2016-04-20 16:32:12 +03:00
];
}
2016-06-29 11:54:16 +03:00
export const decorateComponentRef = _decorateComponentRef;
2016-04-20 16:32:12 +03:00
export const ENV_PROVIDERS = [
...PROVIDERS
];