无法在plnkr中导入'angulars / router'

时间:2016-07-13 14:20:52

标签: angular

当我尝试在项目中导入路由器类时,Plnkr失败

import {Component} from '@angular/core'
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router';

抛出以下错误:

VM883 zone.js:101GET https://npmcdn.com/@angular/src/directives/router_link_active 

这是plnkr: http://plnkr.co/edit/9okaVfVSsRhPxexP9HNw?p=preview

1 个答案:

答案 0 :(得分:0)

添加到您的systemjs配置以下内容:

'@angular/router': {
  main: 'index.js',
  defaultExtension: 'js'
}

<强> Plunker

如果你想使用旧版本的路由器,那么:

'@angular/router-deprecated': {
   main: 'index.js',
   defaultExtension: 'js'
}

import { RouteConfig } from '@angular/router-deprecated';

<强> Plunker router deprecated