Calling A Function In Another Function With AngularJS Factory
I have an AngularJS factory that has multiple functions. I want to call one of the functions inside the other function as shown below: .factory('AppStart', function($cordovaSQLite)
Solution 1:
To accomplish this, I recommend defining your functions with names, and then creating a service object with properties that refer to them, as I did below:
.factory("AppStart", function($cordovaSQLite) {
function init() {
var res = "hello";
console.log("in load start up page");
}
function create_table() {
init();
}
return {
init: init,
create_table: create_table
};
});
Post a Comment for "Calling A Function In Another Function With AngularJS Factory"