2016-10-10 140 views
0

我有一個按鈕,將我重定向到另一個視圖,位於一個href標記中。當我點擊按鈕時,它將我重定向到一個href視圖。像:Ionic javascript - 點擊標籤中的按鈕

<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

更改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"); 
} 
+0

我有你的代碼相同的問題。當我點擊按鈕時,它的開始gotoChat()和Close()而不是Close() – Ron