Sharing Top Content from the Angular-sphere.

Learn Angular 4.0 In 10 Days

Learn #Angular4.0 In 10 Days - Route Process - Day 9 by @debasiskolsaha cc @CsharpCorner

  • Routing allows us to specify some aspects of the application’s state in the URL.
  • Adding routing, however, allows the user to go straight into certain aspects of the application.
  • This is very convenient as it can keep your application linkable and bookmarkable and allow users to share links with others.
  • Routing allows you to, – – The Routes type is an array of routes, that defines the routing for the application.
  • This is where we can set up the expected paths, the components we want to use and what we want our application to understand them as.

In this article, we will discuss about the route process for a single page application in angular 4.0.

Let us start day 9 of the “Learning Angular 4.0 in 10 Days” series. In the previous articles, we discussed Ajax Request handling in Angular 4.0. If you want to read the previous articles of this series, do visit the below links.

Angular 4.0 brings many improved modules to the Angular framework including a new router called the Component Router. The component router is a totally configurable and feature-packed router. Features included are standard view routing, nested child routes, named routes and route parameters.

Why Routing?

Routing allows us to specify some aspects of the application’s state in the URL. Unlike with server-side front-end solutions, this is optional – we can build the full application without ever changing the URL. Adding routing, however, allows the user to go straight into certain aspects of the application. This is very convenient as it can keep your application linkable and bookmarkable and allow users to share links with others.

Routing allows you to,

Route Definition Objects

The Routes type is an array of routes, that defines the routing for the application. This is where we can set up the expected paths, the components we want to use and what we want our application to understand them as.

Each route can have different attributes; some of the common attributes are,

redirectTo – redirect route if needed; each route can have either component or redirect attribute defined…

Learn Angular 4.0 In 10 Days