Ashish Patel: Notes

Atom feed

Recently added: Xunit, Publisher subscriber pattern, Request reply pattern, Middleware pattern, Command pattern

To implement routing in Angular 4, we import RouterModule from @angular/router. Router module takes an input as array. Array is made up of objects containing the path and the component.

Example of Router Module

import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { RouterModule } from "@angular/router";

import { AppComponent } from "./app.component";
import { NewCmpComponent } from "./new-cmp/new-cmp.component";
import { ChangeTextDirective } from "./change-text.directive";
import { SqrtPipe } from "./app.sqrt";
  declarations: [SqrtPipe, AppComponent, NewCmpComponent, ChangeTextDirective],
  imports: [
        path: "new-cmp",
        component: NewCmpComponent
  providers: [],
  bootstrap: [AppComponent]
export class AppModule {}

Created 2019-01-23T11:45:03+05:18, updated 2022-01-29T02:34:00+00:00 · History · Edit