Skip to content

Latest commit

 

History

History
12 lines (7 loc) · 1.13 KB

routing_in_angular_2.md

File metadata and controls

12 lines (7 loc) · 1.13 KB

Routing in Angular 2

The Angular 2 team reworked routing from the ground up. The new component router allows you to configure routes using annotation on the main app component and map each route to the corresponding component. There are three main components used to configure routing:

  • RouteConfig - Annotation similar to View and Component used to define the routes in the main app
  • RouterOutlet - Placeholder directive similar to ng-view that renders the content of each route
  • RouterLink - Used to define links to the different routes within the application.

Refer to the official documentation for more information.

Angular 2's component router also allows for child routes, lazy loading of routing data and a new concept called Auxiliary Routes, which we will cover in this section. First, let's take a look at the @RouteConfig decorator and how it is used.