2

The instructions here didn't work for me:

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

I did

npm install --save angular2-moment

worked fine, then I attempted to do:

typings install --save moment 

but got typings: command not found error, then I did the import in my app.module.ts file:

import { MomentModule } from 'angular2-moment';

included it in my module declarations and entry components array, ran the build and got:

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

VincenzoC
  • 30,117
  • 12
  • 90
  • 112
Spilot
  • 1,495
  • 8
  • 29
  • 55

1 Answers1

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:[
       /**
       ...

       **/
    ]
})

This works check this link https://github.com/rahulrsingh09/AngularConcepts/blob/master/src/app/app.module.ts line 115

Rahul Singh
  • 19,030
  • 11
  • 64
  • 86
  • No I hadn't put it there.. It worked after I put it in imports and removed it from the declaration and entryComponents arrays. – Spilot Jun 21 '17 at 14:43