2016-09-21 2 views
0

Я попытался создать образец проекта из quickstart в угловом 2.0.0 в aspnetcore, приложение компилируется, но когда я выполняю приложение, я получаю следующую ошибку в хром-консолиПроблемы после перехода на окончание Angular2 - Неожиданный токен <

[![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 отображается несколько раз. См. Прилагаемый снимок. enter image description here По ошибке в строке: 17 из index.html пытается загрузить приложение

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); 

какие-либо идеи, почему я» m получить эту ошибку?

+0

Я обновил изменения в github, который является рабочим решением в финальной версии, любой, кто хочет, чтобы проект семян для angular2 final в aspnetcore мог использовать его :) – Krishnan

ответ

1

Я просто посмотрю на ваш код. Вы должны быть:

  1. Изменение templateUrl в шаблон в AppComponent.ts

  2. Использование глотка, чтобы скопировать все библиотеки нужно для вашего приложения в вашей Lib папки и изменения НПМ импровизировать как:

    'npm': 'lib /'

Надеюсь, что эта помощь!

Смежные вопросы