angular2 * ngFor对象数组IE11错误

时间:2017-04-04 12:04:10

标签: angular

成分<​​/ P>

public steps: any[] = [{name: 1}, {name: 2}]

模板

<div *ngFor="let step of steps">{{ step.name }}</div>

适用于除IE 11之外的所有浏览器。给我错误&#39;错误:组件类组件中的错误 - 内联模板:3:13导致:对象预期&#39;

我谷歌很多,并尝试了所有可能的es-shim,core-js等,而不是那个。只有当我使用对象数组时才会出现错误,简单数组工作正常。请提出任何建议

我正在使用现代的webpack启动器https://github.com/AngularClass/angular2-webpack-starter 这是我的polyfills

// TODO(gdi2290): switch to DLLs

// Polyfills

// import 'ie-shim'; // Internet Explorer 9 support

// import 'core-js/es6';
// Added parts of es6 which are necessary for your project or your browser support requirements.
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/set';
import 'core-js/es6/weak-map';
import 'core-js/es6/weak-set';
import 'core-js/es6/typed';
import 'core-js/es6/reflect';
// see issue https://github.com/AngularClass/angular2-webpack-starter/issues/709
// import 'core-js/es6/promise';

import 'core-js/es7/reflect';
import 'zone.js/dist/zone';

// Typescript emit helpers polyfill
import 'ts-helpers';

if ('production' === ENV) {
  // Production

} else {

  // Development
  Error.stackTraceLimit = Infinity;

  /* tslint:disable no-var-requires */
  require('zone.js/dist/long-stack-trace-zone');

}

这是我的js

webpackJsonpac__name_([0],{

/***/ 386:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__empty_routing__ = __webpack_require__(388);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__empty_component__ = __webpack_require__(387);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmptyModule", function() { return EmptyModule; });



// components

var EmptyModule = (function () {
    function EmptyModule() {
    }
    return EmptyModule;
}());
EmptyModule = __decorate([
    __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({
        declarations: [
            __WEBPACK_IMPORTED_MODULE_3__empty_component__["a" /* EmptyComponent */]
        ],
        imports: [
            __WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"],
            __WEBPACK_IMPORTED_MODULE_2__empty_routing__["a" /* EmptyRouting */]
        ]
    })
], EmptyModule);



/***/ }),

/***/ 387:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(1);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EmptyComponent; });

var EmptyComponent = (function () {
    function EmptyComponent() {
        this.steps = [{ name: 1 }, { name: 2 }];
    }
    return EmptyComponent;
}());
EmptyComponent = __decorate([
    __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({
        selector: 'empty',
        template: window['isMobile'] ? __webpack_require__(391) : __webpack_require__(392),
        styles: [__webpack_require__(393)]
    })
], EmptyComponent);



/***/ }),

/***/ 388:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_router__ = __webpack_require__(63);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__empty_component__ = __webpack_require__(387);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EmptyRouting; });


var emptyRoutes = [
    {
        path: '',
        component: __WEBPACK_IMPORTED_MODULE_1__empty_component__["a" /* EmptyComponent */]
    },
];
var EmptyRouting = __WEBPACK_IMPORTED_MODULE_0__angular_router__["RouterModule"].forChild(emptyRoutes);


/***/ }),

/***/ 389:
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(390)();
// imports


// module
exports.push([module.i, "", ""]);

// exports


/***/ }),

/***/ 390:
/***/ (function(module, exports) {

/*
    MIT License http://www.opensource.org/licenses/mit-license.php
    Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function() {
    var list = [];

    // return the list of modules as css string
    list.toString = function toString() {
        var result = [];
        for(var i = 0; i < this.length; i++) {
            var item = this[i];
            if(item[2]) {
                result.push("@media " + item[2] + "{" + item[1] + "}");
            } else {
                result.push(item[1]);
            }
        }
        return result.join("");
    };

    // import a list of modules into the list
    list.i = function(modules, mediaQuery) {
        if(typeof modules === "string")
            modules = [[null, modules, ""]];
        var alreadyImportedModules = {};
        for(var i = 0; i < this.length; i++) {
            var id = this[i][0];
            if(typeof id === "number")
                alreadyImportedModules[id] = true;
        }
        for(i = 0; i < modules.length; i++) {
            var item = modules[i];
            // skip already imported module
            // this implementation is not 100% perfect for weird media query combinations
            //  when a module is imported multiple times with different media queries.
            //  I hope this will never occur (Hey this way we have smaller bundles)
            if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
                if(mediaQuery && !item[2]) {
                    item[2] = mediaQuery;
                } else if(mediaQuery) {
                    item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
                }
                list.push(item);
            }
        }
    };
    return list;
};


/***/ }),

/***/ 391:
/***/ (function(module, exports) {

module.exports = "Empty Mobile Version"

/***/ }),

/***/ 392:
/***/ (function(module, exports) {

module.exports = "<div *ngIf=\"steps\">\n    <div *ngFor=\"let step of steps\">{{ step.name }}</div>\n</div>"

/***/ }),

/***/ 393:
/***/ (function(module, exports, __webpack_require__) {


        var result = __webpack_require__(389);

        if (typeof result === "string") {
            module.exports = result;
        } else {
            module.exports = result.toString();
        }


/***/ })

});
//# sourceMappingURL=0.chunk.js.map

1 个答案:

答案 0 :(得分:1)

答案是添加index.html PrincipalSearcher srch = new PrincipalSearcher(User); ((DirectorySearcher) srch.GetUnderlyingSearcher()).ReferralChasing = ReferralChasingOption.All; 。考虑到我在polyfills中有它,我仍然不知道它为什么没有它呢?