Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between router and router-deprecated in angular2

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?

like image 741
Illorian Avatar asked May 18 '16 08:05

Illorian


People also ask

What is difference between routerLink and routerLink?

What is the difference between [routerLink] and routerLink ? How should you use each one? They're the same directive. You use the first one to pass a dynamic value, and the second one to pass a static path as a string.

What is router and why is it used in Angular?

Angular Routinglink As users perform application tasks, they need to move between the different views that you have defined. To handle the navigation from one view to the next, you use the Angular Router . The Router enables navigation by interpreting a browser URL as an instruction to change the view.

What is Angular router and router module?

Adds directives and providers for in-app navigation among views defined in an application. Use the Angular Router service to declaratively specify application states and manage state transitions.

What is a router in Angular 9?

Routing in Angular allows the users to create a single-page application with multiple views and allows navigation between them.


1 Answers

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

like image 194
Pardeep Jain Avatar answered Sep 19 '22 20:09

Pardeep Jain