Navigate to another page with a button in angular 2

前端 未结 7 1043
天命终不由人
天命终不由人 2020-12-12 18:00

I am trying to navigate to a another page by clicking a button but it fails to work. What could be the problem. I am now learning angular 2 and it\'s a bit tough for me now.

相关标签:
7条回答
  • 2020-12-12 18:33

    You can use routerLink in the following manner,

    <input type="button" value="Add Bulk Enquiry" [routerLink]="['../addBulkEnquiry']" class="btn">
    

    or use <button [routerLink]="['./url']"> in your case, for more info you could read the entire stacktrace on github https://github.com/angular/angular/issues/9471

    the other methods are also correct but they create a dependency on the component file.

    Hope your concern is resolved.

    0 讨论(0)
提交回复
热议问题