I generated the skeleton of the app with phonegap-angular-seed and he created a factory with the phonegap event deviceready according to this link. How should I call this event properly on my Angularjs controller?
So this is just a simple service that returns a callback function for your use once the event has fired.
First you need to add the dependency for the service in your module definition.
var app = angular.module('myApp', ['App.services']);
Then you can inject the cordovaReady into your controller.
app.controller('myController', ['$scope', 'cordovaReady', function($scope, cordovaReady) {
cordovaReady(function () {
// Device ready event has fired when this function fires
});
}]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With