Popup Alert show once

Is it possible make $ionicPopup (alert) show once.

Am having this in my controller:
$scope.$on(’$ionicView.loaded’, function(event) {
title: ‘Don’t eat that!’,
template: ‘It might taste good’

I actually want it to show once (the first time the user visit the view/page).

You could add a Boolean and make a conditional… If true, store to local device and show pop up, else do nothing.

Thanks, please can you show me an example.

Soemthing like this, but there are many ways.

add $localStorage to your controller.

   var popupShown = false;
   if(popupShown == false){
      title: 'Don\'t eat that!',
      template: 'It might taste good',
      buttons: [
         text: '<b>OK</b>',
         onTap: function() {
           $localStorage.popupShown = true;

I havent tried this as I don’t use ionic1 anymore. Please let me know if you get errors.

1 Like

Ok, thanks so much, I will try it.