I'm playing with Angular.js and especially with $http
and the following code:
$http.get('test.url').onsuccess(function(res){});
I was wondering how can I program a structure like that. First try was to determine this within the Angular.js code, but my JavaScript knowledge is maybe a way too weak to understand all the code.
So, I tried the following myself:
var command = function(){
this.execute = function(cmd){
setInterval(function(){
// What to call here?
}, 60 * 60, 1000);
return this;
};
this.onsuccess = function(callBack){
return this;
}
}
var bla = new command();
bla.execute("myCommand").onsuccess(function(result){
console.log(result);
});
I'm pretty sure my code is wrong as hell. What have I to call to get all this stuff working?