Access $ionicPopup() outside controller.?


#1

I want to access $ionicPopup() outside controller ? i.e. in an external js file. is that possible?


#2

Yes, it works for me:

//my view
< button class=“button button-clear” ng-click=“test()”></ button> //there are spaces on the tags to show on the comment

//my controller
myApp.controller(‘Home’, function($scope, $ionicPopup) {
$scope.test= function (){
test2($ionicPopup);
}
});

// external js file
function test2(popup) {
popup.alert({
title: ‘Error!’,
template: 'I don’t know! :confused: '
});
}