Answers for "how to navigate from one page to another in angular"

0

how to navigate from one page to another in angular

import { Router } from '@angular/router';

export class YourComponentClassName implements OnInit {

    constructor(private router: Router) {}

    gotoHome(){
        this.router.navigate(['/home']);  // define your component where you want to go
    }

}
Posted by: Guest on May-22-2021
0

how to navigate from one page to another in angular

const routes: Routes = [
  { path:'', component:LoginComponent},
  { path: 'home', component:HomeComponent },  // you must add your component here
  { path: '**', component:PageNotFoundComponent }
];
Posted by: Guest on May-22-2021
0

how to navigate from one page to another in angular

<button class="btn btn-primary" (click)="gotoHome()">Home</button>
Posted by: Guest on May-22-2021

Code answers related to "how to navigate from one page to another in angular"

Browse Popular Code Answers by Language