ng-click not working in ion-scroll even when all $scope variables are in an object
Asked Answered
M

2

0

I have created a plnkr for this problem. I can't get the ng-click to work on this page. I thought I could solve this issue, with the answers I got from this question: Why do I need $parent to enable the function in ng-click when using ion-scroll?

But even when I use all the $scope variables in an object the function is not executed.

Mcbryde answered 12/5, 2015 at 12:16 Comment(1)
as a suggestion my friend, swap over controllerAs to avoid the scope issue we talked in the other question, it will force you to have an object in everything without having to create an ugly controller.Crewelwork
C
1

For some kind of reason (I am not an Ionic dev), ionic makes the <label> swallow all the click events. So you need to change that label to anything else or put the ng-repeat outside it. I wrote an example at plunker

<div ng-click="foo()">This one works</div>
<label>
  <div ng-click="foo()">This one doesn't</div>
</label>
Crewelwork answered 12/5, 2015 at 13:7 Comment(0)
G
0

Try this:

<ion-scroll direction="x">
    <div class="icon app-symbol" ng-repeat="image in data.default_images" >
        <a ng-click="data.setCurrentImage(image)"> 
            <img ng-src="{{ image.src }}" >
        </a>
    </div>
</ion-scroll>
Gwenette answered 12/5, 2015 at 12:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.