[英]Plunker add angular2-moment package into angular2 app
Using the default templates provided by Plunker to create angular2 apps, I've been trying to import angular2-moment into my angular2 app on Plunker. 使用Plunker提供的默认模板来创建angular2应用程序,我一直试图将angular2-moment导入到我在Plunker上的angular2应用程序中。
import * as moment from 'moment';
this is how my plunker config.js looks like 这就是我的朋克config.js的样子
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
paths: {
'npm:': 'https://npmcdn.com/'
},
//map tells the System loader where to look for things
map: {
'app': './src',
....other angular2 packages work fine...
'rxjs': 'npm:rxjs',
'moment': 'npm:moment@2.16.0',
'angular2-moment': 'npm:angular2-moment@1.0.0',
'typescript': 'npm:typescript@2.0.2/lib/typescript.js'
},
//packages defines our app package
packages: {
'app': {
main: './main.ts',
defaultExtension: 'ts'
},
'rxjs': {
defaultExtension: 'js'
},
'angular2-moment': {
defaultExtension: 'js'
}
}
});
What am I missing here? 我在这里想念什么?
Try import like below: 尝试如下所示导入:
import {MomentModule} from 'angular2-moment';
Reference: https://github.com/urish/angular2-moment 参考: https : //github.com/urish/angular2-moment
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.