how to navigate to another page in angular code example

Example 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');
};

Example 2: this.router.navigate

<a routerLink="/red-pill/neo">Go!</a>

Example 3: this.router.navigate

<a [routerLink]="['/', 'red-pill', {x: 'white-rabbit'}, 'neo']">
  Param!
</a>