离子javascript - 单击标签中的按钮

时间:2016-10-10 05:46:02

标签: ionic-framework ionic2

我有一个按钮,可以将我重定向到另一个视图,在href标签中。当我点击按钮时,它会将我重定向到href视图。像:

<a ng-click="gotoChat()" /*Redirect to another view
        class="item item-avatar-right item-icon-left">
  <i class="icon" ng-hide="{{item.toClose}} == 0">
    <button ng-click="Close('{{item.key}}')" class="button button-assertive">סגור    בקשה</button>
   </i>*/When I click on the button its start gotoChat() and Close() instead of only Close()
</a>

我该怎么做才能将我重定向到按钮功能?

1 个答案:

答案 0 :(得分:1)

将href更改为html中的div,如下所示

<div ng-click="gotoChat()" class="item item-avatar-right item-icon-left">
   <i class="icon" ng-hide="{{item.toClose}} == 0"><button ng-click="Close('{{item.key}}')" class="button button-assertive">סגור בקשה</button></i>*/When I click on the button its redirect me to a href function
</div>

并在您的控制器中

$scope.gotoChat = function(){
   $state.go("STATE OF PAGE FOR REDIRECT");
}