September 2017
Intermediate to advanced
450 pages
11h 24m
English
To mount the router to the root of our application, we must first import the RouterModule from the router and call the forRoot method to tell the router that we are setting up routes on the root of our web application:
import { NgModule } from '@angular/core';import { FormsModule } from '@angular/forms';import { HttpModule } from '@angular/http';import { RouterModule } from '@angular/router';import { AppComponent } from './app.component'@NgModule({ ... imports: [ BrowserModule, FormsModule, HttpModule, RouterModule.forRoot([])],...})export class AppModule { }
With the router set up on the root of our web application, we are now able to provide a mapping between the Universal Resource Indentifier (URI) of the route that we want ...
Read now
Unlock full access