$ionicLoading in place of toast - ng-click not working?


I was using $cordovaToast but I’ve been forced to switch to something non-native in order to embed a link with a click target in a status message. Basically, my use case is displaying a “action completed | undo” option similar to what’s in Google’s Gmail app (see https://github.com/soarcn/UndoBar) Has anyone else tried this? I basically just modified the css to bottom-position the toast and restyled it a bit.

My issue right now is that I can’t seem to get an ng-click inside the template wired up to work with a function on the local scope. Here’s my code, note the scope option on show(). The function in question is never called:

$ionicLoading.show({ templateUrl: 'templates/ok-undo-action.html', scope: $scope, noBackdrop: true, duration: 2000 });

And the corresponding template:

  Something happened
  <a ng-click="undo()">
    <i class="icon ionicon ion-arrow-return-left"></i>

Any suggestions very much appreciated.


Not sure but I think “a” tag doesn’t work with ng-click.
Did you try to put a button instead?


Doesn’t seem to make a difference. ng-click isn’t binding. No function undefined warnings, etc.


I will ask a stupid question :smile:
Did you have ng-app directive?


Well it’s in an Ionic app. So yes, there’s an ng-app on the body tag as usual?


Passing scope still doesn’t seem to work… hmm.