sree sree - 2 months ago 30
AngularJS Question

using $ionic Popup

Hi Im using ionic to create a simple popup. Here Im not able to display the pop-up information after clicking the button. I don't know where Im going wrong and please help me in displaying the pop-up .And Im getting error

ionic.bundle.js:26794 TypeError: Cannot read property 'show' of undefined
at Scope.$scope.showPopup


link

angular.module('CarWash',[$ionic]).controller('popSelect',['$scope',function($scope,$ionicPopup){
$scope.data={};
$scope.showPopup = function() {
$ionicPopup.show({
title:'select car wash',
template: "Hello customer !!!",

});
alertpop.then(function(res){
console.log('Inside pop-up');

Answer

You messed in Dependency injection, you have to inject $ionicPopup to use it in controller factory function.

angular.module('CarWash',[$ionic])
.controller('popSelect',['$scope', '$ionicPopup', //<-- injected $ionicPopup here
   function($scope, $ionicPopup){ //<-- now you can access $ionicPopup instance here.
Comments