I am trying to start using angular 2 cli.
I want to use momentjs in my project so here is what I have done:
1. created project using angular cli.
2. run np
I’m not currently using moment.js myself right now. So I’m not sure, but it seems to me that you are trying to use moment.js as a typescript module and maybe it is not a typescript module. I suggest another approach. Do not use moment.js as module to import but use a d.ts file instead. To accomplish this I’m use tsd: Open a cmd:
Global install of tsd
Change to your project root
Among another things, Creates a tsd.json file to keep track of your installed d.ts files
After this I did get code completion in typescript after: moment.
Did not test further...
I'm now using typings, instead of tds, as manager for TypeScript definitions. Tds is now deprecated.
You probably can install moment.d.ts like this: typings install moment --ambient --save
The answer can be found in the following link: https://github.com/angular/angular-cli/issues/274#issuecomment-192490084