$ionicPopup undefined problem

Does anyone know why $ionicPopup is undefined?

sample code

angular.module('post.controllers', ['post.services'])

.controller('postCtrl', ['$scope', '$state', '$stateParams',
    function (postService, $scope, $state, $stateParams, $ionicLoading, $ionicPopup) {

console.log($ionicPopup) //<-- here I get undefined 

showAlert("hi")  // <-- app crashed and it says "Can read property 'alert' of undefined"
        function showAlert(message) {
            var alertPopup = $ionicPopup.alert({
                title: 'Alert',
                template: message
            });
        }

}])

try this

.controller('postCtrl', function($scope, $state, $stateParams, $ionicLoading, $ionicPopup) {}

You missed $ionicPopup injection in annotation. Try this
.controller(‘postCtrl’, [’$scope’, ‘$state’, ‘$stateParams’,’$ionicLoading’,’ $ionicPopup’,
function ($scope, $state, $stateParams, $ionicLoading, $ionicPopup) {