2017-03-14 4 views
-1

すべてが角2で良好でした。しかし、私は4のベータリリースにアップグレードし、起動時にNoAnnotationErrorを取得しました。私にはサービスはありませんし、注射剤もありません。Angular 4へのアップグレードで説明できない "NoAnnotationError"

ここに私のコードです:

app.ts

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

import { AppModule } from './app.module'; 

platformBrowserDynamic().bootstrapModule(AppModule); 

app.component.ts

require('./sass/index'); 

import 'zone.js'; 
import 'reflect-metadata'; 
import { Component } from '@angular/core'; 


@Component({ 
    selector: 'my-app', 
    template: ` 
    <div class="app"> 
    The Angular app has now loaded! 
     <router-outlet></router-outlet> 
    </div>` 

}) 

export class AppComponent { 
    error: any; 
    showNgFor = false; 
    constructor() 
    { 

    } 
} 

app.module.ts

import { NgModule }   from '@angular/core'; 
import { BrowserModule }  from '@angular/platform-browser'; 
import { HttpModule }  from '@angular/http'; 
import { RouterModule }  from '@angular/router'; 

import { AppComponent }  from './app.component'; 

@NgModule({ 
    imports:  [ 
     BrowserModule, 
     HttpModule, 
     RouterModule.forRoot([]) 
    ], 
    declarations: [ AppComponent ], 
    bootstrap: [ AppComponent ] 
}) 
export class AppModule { } 

それは非常に簡単なものです...私は何が可能かわからないここに注釈付けできなかった可能性があります。

そして、ここでは完全な誤りだ:

Error: Cannot resolve all parameters for 'Parser'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'Parser' is decorated with Injectable. 
+0

ドキュメントを見てください...、アップAngular4はありません。 =) – lin

+0

ここで推測します...あなたがNG4に移ったとき、それはあなたのパッケージに依存する他のすべてのものを更新しましたか?同様に、最新版のTypeScript? –

答えて

0

私は非常に愚かです。私はAngular 4のベータ版を使用していました。リリース候補の1つではありません。 rc2にアップグレードすると修正されました。

関連する問題