Angular async function executor ES5 friendly
npm install amp-async-functionjs
npm install amp-async-function --save
`
Include module amp-async-function into your app.
`js
angular.module("my.app", ["amp-async-function"]);
`
Guide:
* Inject the factory: asyncFunction;
Call your function: asyncFunction.execute(yourFunction, [] /array of params/, 0 /delay*/);
Use the factory as example below:
`js
angular
.module("async-func-demo")
.controller("AsyncFuncController", AsyncFuncController);
function AsyncFuncController(asyncFunction) {
var vm = this;
vm.exec = function () {
asyncFunction.execute(vm.asyncFunc, [1], 10)
.then(function (data) {
// function resolved
});
}
vm.asyncFunc = function (id) {
return id;
}
}
``