我在尝试安装 angular2 时刻时遇到错误



这里的说明对我不起作用:

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';

将其包含在我的模块声明和入口组件数组中,运行构建并得到:

"错误:模块'AppModule'声明的意外模块'时刻模块'"

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 行

相关内容

最新更新