2016-06-18 3 views
-1

이유가 무엇이든간에 Angular2는 내 페이지 중 하나에 만족하지 않습니다. 다른 페이지는 정상적으로 작동하는 것 같습니다. 노 키누 페이지에서만 생성되는 오류는 다음과 같습니다. 예외 : 오류 : 알려지지 않은 약속 있음 : SyntaxError : 유효하지 않거나 예기치 않은 토큰Angular2 오류 : 예외 : 오류 : 잡히지 않음 (약속 있음) : 구문 오류 : 잘못되었거나 예기치 않은 토큰

프로젝트가 현재 매우 작고 오류로 인한 원인을 확신하지 못합니다. 각도 2 퀵 스타트 가이드와 동일하게 알고 있습니다.

도움이 될 것입니다. 감사!!!

main.ts

import { bootstrap } from '@angular/platform-browser-dynamic'; 
import { ROUTER_PROVIDERS } from '@angular/router-deprecated'; 
import { MainComponent } from './main.component'; 

import { Title } from '@angular/platform-browser'; 

bootstrap(MainComponent, [ Title, ROUTER_PROVIDERS ]); 

main.component.ts

// Import the native Angular services. 
import { Component } from "@angular/core"; 
import { Title } from '@angular/platform-browser'; 
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated'; 

import { HomeComponent } from './home.component'; 
import { QuinoaComponent } from './quinoa.component'; 
import { NaturalHerbsComponent } from './naturalherbs.component'; 

@Component({ 
    selector: 'c-main', 
    templateUrl: 'app/html/main.component.html', 
    directives: [ROUTER_DIRECTIVES], 
    providers: [ROUTER_PROVIDERS] 
}) 

@RouteConfig([ 
    { 
     path: '/home', 
     name: 'Home', 
     component: HomeComponent, 
     useAsDefault: true 
    }, 
    { 
     path: '/quinoa', 
     name: 'SuperfoodQuinoa', 
     component: QuinoaComponent 
    }, 
    { 
     path: '/naturalherbs', 
     name: 'NaturalHerbs', 
     component: NaturalHerbsComponent 
    } 
]) 

export class MainComponent { 
    /*public constructor(private titleService: Title) { } 

    public setTitle(newTitle: string) { 
     this.titleService.setTitle(newTitle); 
    }*/ 
} 

erroring 구성 요소 : quinoa.component.ts

import { Component } from '@angular/core'; 

@Component({ 
    selector: 'c-quinoa', 
    templateUrl: 'app/html/quinoa.component.html' 
}) 

export class QuinoaComponent { } 
+0

html로 오류가있는 것 같습니다. 마치

태그가없는 것처럼 보이지만 실제 내용을 저장하자마자 오류가 발생합니다. – matt2405

답변

0

그것은 밝혀 그 에디터 I 사용하고있어 당신을 위해 들여 쓰기 할 수 있는지 물어 보는 팝업을줍니다. 그리고 어떤 이유로 anglejs 2는 그렇지.

내가 사용하는 편집기는 webstorm 2016입니다.

관련 문제