$ionicPopup.alert is not a function error!

Ionic popup not working…

<button class = "button" ng-click = "showAlert()">Add Popup Show</button>    

$scope.showAlert = function() {
   var alertPopup = $ionicPopup.alert({
     title: 'Don\'t eat that!',
     template: 'It might taste good'

   alertPopup.then(function(res) {
     console.log('Thank you for not eating my delicious ice cream cone');

have you injected $ionicPopup in your controller?

Yes, I have!

.controller('ListController', ['$scope', '$http', '$state','$window', '$ionicActionSheet', '$timeout','$ionicPopup', 'updateDbService',function($scope, $http, $state, $window, $ionicActionSheet,$ionicPopup, $timeout,updateDbService) {

ah …

you switched the $timeout and $ionicPopup :slight_smile:



$ionicPopup, $timeout


Thank you so much! Sorry I just realised I never posted it! Also, why?

haha … I had the same “problem” once … kept me debugging almost a hour untill I figured it out

I might receive some hate for this…

But when you don’t minify your code, you dont really need to explicitly name your injections.

Thank you so much for posting this. I assumed Ionic didn’t care what order the injected parameters were in because of seeing examples where they were out of order but you helped me fix a bug I’ve spent almost a week trying to fix with this!