由网友(我若不笑的猖狂谁替我坚强)分享简介:在我的控制器:$scope.homeAction = function() {console.log("HomeAction");};在我看来:call homeAction()在单击按钮时,Chrome和Firefox按预期的方式...
在我的控制器:
$scope.homeAction = function() {
console.log("HomeAction");
};
在我看来:
<button ng-click="homeAction()">call homeAction()</button>
在单击按钮时,Chrome和Firefox按预期的方式方法被执行,但执行IE两次。任何想法,为什么?
When clicking the button, the method gets executed as expected by Chrome and Firefox, but IE executes it twice. Any idea why?
下面是重现这一问题的plunker: http://plnkr.co/edit/pedZKjIVGDAYfMl0ZphJ
Here is a plunker that reproduces the issue: http://plnkr.co/edit/pedZKjIVGDAYfMl0ZphJ.
推荐答案
只需添加键入=按钮
来的按钮,它应该是固定的。默认的行为是提交,显然与您code弄乱。
Just add type="button"
to your button and it should be fixed. Default behaviour is submit and apparently that messes with your code.
<ion-view title="Home">
<ion-content padding="true">
<button type="button" ng-click="homeAction()" class="button button-block button-positive">call homeAction()</button>
</ion-content>
</ion-view>
相关推荐
最新文章