mercredi 8 février 2017

Ionic Popup ng-click not working

Vote count: 0

I have a modal in Ionic that shows a list of country flags for the user to choose, however my ng-click on the language flag don't appear to fire the $scope.function() I have assigned. Here's what I've got:

Showing the modal:

$scope.showLanguages = function() {
  var myPopup = $ionicPopup.show({
       templateUrl: 'templates/languageSelect.html',
       title: 'Language Select',
       scope: $scope,
       buttons: [
         {
             text: '<b>Close</b>',
             type: 'button-positive',
             onTap: function (e) {
                return;
             }
         }
       ],
       cssClass: 'animated bounceInDown'
  });
}

My template that displays my flags, with the ng-click on them:

<div class="row">
  <button ng-class="getFlagClass(language)" ng-click="setLanguage()" class="col flag-icon flag-icon-squared" ng-repeat="language in data.languages" />
</div>

And finally my ng-click function which is on the same scope as the one that opens the modal (notice the $scope being passed into the modal)

$scope.setLanguage = function() {
    alert('test');
}

Can anyone suggest what I might be doing wrong here? This looks like a bug in Ionic but I could be wrong.

Thanks

asked 19 secs ago

Let's block ads! (Why?)



Ionic Popup ng-click not working

Aucun commentaire:

Enregistrer un commentaire