Angular 2 redirect on click

后端 未结 6 683
攒了一身酷
攒了一身酷 2020-12-15 20:20

How to create simple redirect on click on some button in Angular 2? Already tried:

import {Component, OnInit} from \'angular2/core\';
import {Router, ROUTER_         


        
6条回答
  •  离开以前
    2020-12-15 20:51

    in your html file right this code.

    
    

    in your component.ts file right this code.

    constructor(private router:Router) { }
    btnClick(){
    this.router.navigateByUrl("/payment");
    }
    

提交回复
热议问题