2016-09-06 16 views
0

在Angular2rc6,我的模塊如下,其中AppComponent,AppService服務,點是一個組成部分,注射服務和數據模型:angualr2:其中申報模式ngModule

import { NgModule }  from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 

import { AppComponent } from './app.component'; 
import { AppService } from './app.service'; 
import { Point } from './point.model'; 

@NgModule({ 
    imports: [ 
    BrowserModule 
    ], 
    providers: [ 
    AppService 
    ], 
    declarations: [ 
    AppComponent, Point 
    ], 
    bootstrap: [ 
    AppComponent 
    ] 
}) 
export class AppModule { } 

頁面拋出錯誤時模型Point是添加到declaration

enter image description here

有什麼想法?

+1

你能告訴我們'point.model.ts'文件嗎? – yurzui

+2

點應該不在聲明中。那些是指令和管道。 –

+0

什麼是Point應該做什麼或做什麼?你爲什麼將它添加到聲明中? –

回答

0

從聲明部分刪除point.ts文件。模型沒有必要在聲明部分有