Ng-click not working in v1.0.0-beta.6

I recently upgraded to v1.0.0-beta-6 and am now experiencing an issue with ng-click. This is my code, which I have drastically shortened to prove my point, but it’s still not working. Clicking on the div will not call myCtrl.navigate at all in iOS or Android. Note however, this DOES work in a browser, just not in any mobile environment.

Am I missing something?

<ion-view title="Title" hide-back-button="true">
    <section ng-controller="MyCtrl as myCtrl">

        <ion-content>

            <div ng-click="myCtrl.navigate()">

                <p>Click me!</p>
            </div>
        </ion-content>
    </section>
</ion-view>

You shouldn’t specify the controller like ng-click=“myCtrl.navigate()” … use just ng-click=“navigate()”, and I’m sorry but don’t use a Controller specified like “MyCtrl as myCtrl” in AngularJS, input only the name of the controller.

This is valid Angular syntax. I prefer the ‘Controller as controller’ syntax rather than putting properties and functions on the $scope. It makes markup so much easier to understand.

Plus, I’m willing to bet that’s not the reason ng-click isn’t working for me.

@smaye81 it actually is the reason it isn’t working. See this codepen: http://codepen.io/anon/pen/iInhe

As for a reason why, I’m not sure. Perhaps @Calendee could enlighten us.

Interesting, but even putting the function on $scope doesn’t fix it in the iOS emulator or Android emulator for me. navigate() simply isn’t invoked at all.

Could you put it in a Codepen?

Here you go: Both of these should work in a browser, but if I deploy this to my device, the doSomething methods (both of them) are not invoked at all.

In addition, this exact code worked before I upgraded to beta.6 on Friday.

Actually, I was able to better narrow down when this worked vs. when it stopped working.

The above code works in 1.0.0-beta.1-nightly-1644, but no longer works in beta.2.

I can’t seem to find the nighty builds for beta.2 otherwise I’d try to narrow it down to a specific build.

I am also having this type of issue in beta 7. The only hack I have found to fix this is to add overflow-scroll=true to the ion-content tag. At least try that and see if it helps. It helped me but I don’t consider that as a permanent solution because that effectively means I am not using ionics scroll logic i am using the browsers.

Thanks, @chale. I’ll give that a try. Hopefully we can get an answer as to the true cause of the problem here some day.

I am definitely experiencing this problem as well. None of the latest betas fixed this issue. Tried it on a Samsung Galaxy S2 with 4.1.2 and a Nexus 7 (2013) with 4.4.

It works fine in the simulator and browser though.

line 10 should be this.doSomething and it works