简体   繁体   中英

Typescript import import angular2 router errors

I am using the following import statement in my TypeScript code

import { Routes, RouterModule } from "@angular/router";

I have a few questions about this

  1. What does the "@" symbol mean in "@angular/router"
  2. I am using angular2 when I try to compile I get the following error cannot find module @angular/router . I am using "angular2": "2.0.0-beta.7",

What does the "@" symbol mean in "@angular/router"

The '@' is just the name of the library. If you look at the systemjs.config at the bottom of the 5 Min Quickstart on angular.io-s web site that's how it's mapped.

Also if you look in to the package.json file. '@angular/...' is the literal name of the package.

I am using angular2 when I try to compile I get the following error cannot find module @angular/router. I am using "angular2": "2.0.0-beta.7"

Firstly you should really consider updating to the new version 'RC5' there were a bunch of breaking changes and fixes.

The reason why you get the error cannot find module @angular/router is probably because you have it mapped wrongly in your systemjs config or you're trying to install a version of the 'router' that doesn't exist.

I think you should really try to follow the 5 Min Quickstarter to set up the initial project and then follow the Routing and Navigation documentation for the routing part.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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