-1

I'm practicing Angular 2, and configured a button with a password entered and a correct one to redirect to a second page. I configured the routing but I do not know how to do it so that it is validated and then redirected.

What I currently have configured in the following but I can not click the button and I would like to redirect to the second page.

enter image description here

enter image description here

enter image description here

Diego Aaron
  • 386
  • 1
  • 6
  • 19

1 Answers1

1

Why are you having both routerLink and click on the same button. you can instead move the routerLink to the code as

validarpass(pass:number) {
    .....
    this.router.navigate(['/component-one']);   
}

Inject the Router to your constructor as below

constructor(private router:Router){
...}
Aravind
  • 40,391
  • 16
  • 91
  • 110