2017-06-21 7 views
2

命令は私のために動作しませんでしたangular2瞬間をインストールしようと、エラーを取得しています:私はここに

https://github.com/urish/angular2-moment

私は

npm install --save angular2-moment 

は、私がしようとしましたが、うまく働きました。

typings install --save moment 

typings: command not foundエラーが発生した場合は、012にインポートしましたファイル:

import { MomentModule } from 'angular2-moment'; 

は私のモジュール宣言とエントリコンポーネントの配列でそれを含め、 は、ビルドを実行して得た:

"Error: Unexpected module 'MomentModule' declared by the module 'AppModule' "

答えて

1
import { BrowserModule } from '@angular/platform-browser'; 
import {MomentModule} from 'angular2-moment'; 
@NgModule({ 
    declarations:[/**...**/] 
    imports:  [BrowserModule,MomentModule], // did you update this line this works for me 
    bootstrap: [AppComponent], 
    providers:[ 
     /** 
     ... 

     **/ 
    ] 
}) 

これは、このリンクhttps://github.com/rahulrsingh09/AngularConcepts/blob/master/src/app/app.module.tsライン115

+0

ありませんを確認する作品私はそれをそこに置かなかった。私はそれをimportに置いて宣言とentryComponents配列からそれを削除した後に働いた。 – Spilot