单击按钮重定向到另一个页面

时间:2019-08-27 05:59:50

标签: html angularjs bootstrap-modal

我做了一个按钮,我想通过它使用angularjs重定向到另一个页面。

如果我在创建按钮的同一页面上编写代码,但我不想这样做,则可以完成。所以帮帮我。

<button type="button" class="btn btn-sm bg-darkgreen addemployeeformbtn"<a href="#/SampleManagementView/>><i class="fa fa-plus"></i>&nbsp; Add New</a></button>  </li>

2 个答案:

答案 0 :(得分:0)

<button type="button" ng-click="redirect()" ...>

在控制器上:

$scope.redirect = function(){
    $window.location = "../#/SampleManagementView/";
}

答案 1 :(得分:0)

 <nav>
      <a routerLink="/SampleManagementView">Sample Management</a>
    </nav>
    <router-outlet></router-outlet>