2016-09-06 47 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文件。模型没有必要在声明部分有