I know this is probably an easy question to answer but I just cannot get my head around it. I need a function that increments a number by 1 and returns a promise.
Here is a fiddle
Failed Example
var incrementingFn = function() {
return $q(function(resolve,reject) {
var n = 0;
$q.resolve(function() {
n += 1;
return n;
}());
}
}
incrementingFn().then(function(res) {
var num = res;
}