简体   繁体   English

无法在plnkr中导入“角度/路由器”

[英]Unable to import 'angulars/router' in plnkr

Plnkr is failing when i attempt to import the router class in my project 当我尝试在项目中导入路由器类时,plnkr失败

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

The following error is thrown: 引发以下错误:

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

Here's the plnkr: http://plnkr.co/edit/9okaVfVSsRhPxexP9HNw?p=preview 这是plnkr: http ://plnkr.co/edit/9okaVfVSsRhPxexP9HNw?p=preview

Add to your systemjs config the following: 将以下内容添加到您的systemjs配置中:

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

Plunker 柱塞

If you want to use old version of router then: 如果要使用旧版本的路由器,则:

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

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

Plunker router deprecated 不推荐使用Plunker路由器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM