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!
'
});
}
1 Like