0
我試圖從quickstart在aspnetcore的角2.0.0中創建一個示例項目,應用程序正在編譯,但是當我執行應用程序時,我在鍍鉻控制檯中收到以下錯誤遷移到Angular2 final之後的問題 - 意外的令牌<
[![index.html:17 Error: SyntaxError: Unexpected token <
at Object.eval (http://localhost:49928/app/main.js:6:36)
at eval (http://localhost:49928/app/main.js:10:4)
at eval (http://localhost:49928/app/main.js:11:3)
Evaluating http://localhost:49928/node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js
Evaluating http://localhost:49928/app/main.js
Error loading http://localhost:49928/app/main.js][1]][1]
我在Github中檢查了應用程序。
我試着調試chrome控制檯中的Network選項卡,並注意到Index.html被多次渲染。請參閱附件快照。 按照該行的錯誤:的index.html的它會嘗試加載應用17
System.import('app').catch(function(err){ console.error(err); });
請找到systemjs.config.js文件
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
'angular2-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
}
}
});
})(this);
爲什麼我的任何想法米得到這個錯誤?
我已經更新了github中最終版本中的工作解決方案中的更改,任何想要在aspnetcore中使用angular2 final種子項目的人都可以使用它:) – Krishnan