Installing Angular 2 RC2 w/ new component router

余生颓废 提交于 2019-12-07 04:18:40

问题


I'm probably missing something simple, but trying to use the new Component Router I can't get VS Code to recognize it.

I changed all my @angular references in package.json to 2.0.0-rc.2; ran npm install and VS Code doesn't like my imports:

When I navigate to the @angular/router folder in node_modules, and inspect the index.d.ts I see all the references for the RC1 router. Removed the @angular folder and installed again, same result.


回答1:


For the new release of angular rc2. The version of router to install is

"@angular/router" : "3.0.0-alpha.6" or "@angular/router" : "3.0.0-alpha.7"

The repo for the router is at https://github.com/angular/vladivostok . The docs on the site https://angular.io/docs/ts/latest/guide/router.html are on alpha.6. I would advice to go through the changelog to know about breaking changes when using alpha.7




回答2:


If you just started to work with Angular router, I suggest you disregard RC1 router and start with the new router v3.

"@angular/router": "3.0.0-alpha.7"

Here is the documentation for Router v3.




回答3:


The router is not maintained as a separate project anymore. It has been recently merged into Angular2 and the router is now in beta.. I would suggest you to use start using the beta by adding a dependency in your package.json file "@angular/router": "3.0.0-beta.2"




回答4:


it is now at V3.RC1. So please update your package.json accordingly

"@angular/router": "3.0.0-rc.1",

You might also have to upgrade your application to Angular2.RC5 and change the way routing is done.



来源:https://stackoverflow.com/questions/37924912/installing-angular-2-rc2-w-new-component-router

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!