Access $ionicPopup() outside controller.?

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

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: '
});
}

1 Like