Problems with basic button ng-click

I have a issues with buttons calling $scope methods, and I’d love any insight or ideas on this.

The problem is that button elements like this do not call the $scope method:

<button class="button" type="button" ng-click="testMe();">

I can create a new app, as shown by this codepen, where this works just fine: http://codepen.io/davidfrahm/pen/GgaWXL

However, I have a real world app that has been around awhile, and after upgrading from 1.0.0-rc.1-nightly-1155 to 1.0.0-rc.2, I start having issues with these simple buttons.

<button class="button" type="button" ng-click="testMe();">
      button with class is broken
</button>
<button type="button" ng-click="testMe();">
      button no class works
</button>
<a class="button" ng-click="testMe();">
     anchor with class works
</a>

In the example above, this is the only code inside my , and the controller only has the testMe function in it, just like the codepen above:

.controller('MyCtrl', function($scope) {
 $scope.testMe = function () {
   alert("testMe()");
 }; 
});

I’m not sure how to debug this any further. The button with class=“button” appears to do nothing when clicked. The event is either not there, or is swallowed by something.

I appreciate any help you can provide.

What version of angular are you using?

Some people have had issues with button clicks when using an angular version less than 1.3.3. Ionic depends on Angular 1.3.X so just make sure your not reolsving to a version of angular less than what ionic depends on?

Holy cow… Yeah, the issue is only in Canary. Even my simple codepen is broken in Canary.

I use Canary to have nice clean separation from my main Chrome browser. That way I can delete cache and stuff in Canary and not impact my daily browsing.

Anyway, I’ll follow that issue #3467 now. Thanks!!!

1 Like

no prob, seems like when some people upgraded to Angular 1.3.3 and above the isue was resolved?

I don’t think so. I looks its an issue specifically with Canary according to my tests and other reports in that Ionic issue.

1 Like