2016-09-21 10 views
0

aspnetcoreのangle 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のアプリケーションをチェックしました。

クロムコンソールの[ネットワーク]タブをデバッグして、Index.htmlが複数回レンダリングされていることに気付きました。添付のスナップショットを参照してください。行にエラーを1として enter image description here :それはアプリケーションにロードしようと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); 

私は「なぜ任意のアイデアをご覧くださいこのエラーが発生しましたか?

+0

ファイナルバージョンで動作する解決策であるgithubの変更を更新しました。aspnetcoreでangular2 finalのシードプロジェクトを使用したい人は誰でもそれを使用できます:) – Krishnan

答えて

1

私はあなたのコードを見ています。あなたは次のようになります。

など、すべてのライブラリがあなたのlib フォルダにアプリの必要なコピーとlibにNPMを変更するがぶ飲みを使用しAppComponent.ts

  • でテンプレートにtemplateUrlを変更

    1. 'npm': 'lib /'

    このヘルプが必要です。

  • 関連する問題