HI. I am trying to create an ionic popup $ionicPopup.show() inside a factory. I want to extract it inside a factory, because I want to use it inside multiple controllers and I want to keep my code DRY.
In my popup template I have two inputs, so I have to pass the scope parameter to the popup. The problem here is that if I pass an object other than $scope to the scope parameter I get an error and $scope cannot be resolved in a factory.
The controllers in which I want to use the popup are third layer controllers (have two parent) e.g. app.search.result. I use ui-router to do this, so I think that I can add the functions in one of the parent controllers.
I found a way to do this in a factory. I pass the $scope as a parameter of a function in a factory.