Angular 4 put a global constant available to zone.js -
i using angular (4 think) typescript , zone.js (0.8.4). import zone.js via "polyfills.ts" file. when inside source code of zone.js, there code this:
var isdisableiecheck = _global['__zone_disable_ie_check'] || false;
my question is, how can set variable in _globals ?
thanks
global
window
object in browser can seen here:
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory() : typeof define === 'function' && define.amd ? define(factory) : (factory()); }(this, <------------ `this` points `window` in global scope (function () { ... });
so can set variable this:
window['__zone_disable_ie_check'] = true;
but need before zone.js
loaded. if load zone.js
in index.html
, add following:
<script> window['__zone_disable_ie_check'] = true; </script> <script src="node_modules/zone.js/dist/zone.js"></script>
Comments
Post a Comment