Difference between router and router-deprecated in angular2

坚强是说给别人听的谎言 提交于 2019-12-10 02:34:54

问题


I've updated from "beta.17" to "2.0.0-rc.1" and I don't understand when I should use router and when router-deprecated?


回答1:


UPDATE TO ANGULAR2 RC

There are alot of changes has been made in routing in angular2 after RC some of them points i am going to mention here may help someone :-

  1. angular2/router has been changed with @angular/router (also you can use old functionality of routing using import of @angular/router-deprecated but as of now we have to use @angular/router).

  2. @RouteConfig has been changed with @Routes .

for example :-

@Routes([
  {path: '/crisis-center', component: CrisisListComponent},
  {path: '/heroes',        component: HeroListComponent}
])

Rest ill update soon my answer as per update in changelog. Thanks to @Benedikt for comment Article for new @Route update to angular2 RC



来源:https://stackoverflow.com/questions/37294497/difference-between-router-and-router-deprecated-in-angular2

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