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

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

No I hadn't put it there.. It worked after I put it in imports and removed it from the declaration and entryComponents arrays.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.