【发布时间】:2016-05-18 09:15:21
【问题描述】:
我想使用 Hashlocationstartergy 在 Angular2 中使用 ES5 进行路由。我为 bootstratpping main.js 截取的代码如下:
(function(app) {
document.addEventListener('DOMContentLoaded', function() {
ng.platform.browser.bootstrap(app.AppComponent, [
ng.router.ROUTER_PROVIDERS, ,
ng.core.provide(ng.common.LocationStrategy, {
useClass : ng.common.HashLocationStrategy
}) ]);
});
})(window.app || (window.app = {}));
运行时出现以下错误:
uncaught TypeError: Cannot read property 'getOptional' of undefined on application_ref.ts:289
注意:我在 html 文件中添加了 angular2-all.umd.dev.js、Rx.umd.js、shims_for_IE.js、angular2-polyfills.js 脚本。
【问题讨论】:
标签: javascript angular angular2-routing