plunker将Angular2矩包装添加到Angular2应用中



使用Plunker提供的默认模板来创建Angular2 Apps,我一直在尝试将Angular2-Moment导入Plunker上的Angular2 App。

import * as moment from 'moment';

这就是我的plunker 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'
    }
  }
});

我在这里缺少什么?

尝试以下类似以下导入:

import {MomentModule} from 'angular2-moment';

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

最新更新