这里的说明对我没用:
https://github.com/urish/angular2-moment
我做到了
npm install --save angular2-moment工作得很好,然后我试着做:
typings install --save moment 但是得到了typings: command not found错误,然后在我的app.module.ts文件中进行了导入:
import { MomentModule } from 'angular2-moment';将其包含在模块声明和条目组件数组中,运行构建并获得:
“错误:模块'MomentModule‘声明的意外模块'AppModule’”
发布于 2017-06-21 08:46:37
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行。
https://stackoverflow.com/questions/44670349
复制相似问题