Answers for "navigate to another page 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
1

add a route to a buttoin in angular

<button type="button" class="btn btn-primary-outline pull-right" (click)="btnClick();"><i class="fa fa-plus"></i> Add</button>    

// myComponent.component.ts file 
import { Router } from '@angular/router';

constructor(private router: Router) {

}
// myComponent.component.thml
btnClick= function () {
        this.router.navigateByUrl('/user');
};
Posted by: Guest on February-09-2020
1

button routing

<a routerLink="/">Go To Home</a>
Posted by: Guest on June-04-2020
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
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

Code answers related to "navigate to another page in angular"

Code answers related to "Javascript"

Browse Popular Code Answers by Language