小编Mar*_*cus的帖子

在Angular 2中添加polyfill代码

如何在Angular 2 cli项目中添加polyfill的代码?

例如,我想使用Mozilla MDN中的以下polyfill :

if (!Array.prototype.includes) {
  Object.defineProperty(Array.prototype, 'includes', {
    value: function(searchElement, fromIndex) {
      if (this == null) { throw new TypeError('"this" is null or not defined'); }
      var o = Object(this);
      var len = o.length >>> 0;
      if (len === 0) { return false; }
      var n = fromIndex | 0;
      var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
      while (k < len) {
        if (o[k] === searchElement) { return …
Run Code Online (Sandbox Code Playgroud)

polyfills angular

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×1

polyfills ×1