Hi,
Im trying to use $ionicLoading
inside a factory. (Coz I thought its a good idea to have the code in one place without repeating it in each controller)
angular.module('<my app>.message', ['ionic'])
.factory('Message', [function($scope, $ionicLoading){
var messageFactory = {};
messageFactory.successMessage = function(message){
$ionicLoading.show({ templateUrl: 'templates/messages/success.html',
noBackdrop: true, duration: 1000 });
}
return messageFactory;
}]);
But the problem is I’m getting this error Cannot read property 'show' of undefined
, Since the same code works fine in the controller, I’m wondering if this meant to be working inside a controller. If so , my question is how can I avoid using the same code for message boxes inside a project.
thanks in advance
cheers
sam