Ich speichere ein Objekt innerhalb des Dienstes in meiner eckigen App, ich kann nicht auf 'dies' innerhalb der Callback-Methode zugreifen. So etwas wie ...angular acses 'this' im Rückruf
app.service("myService", ['$http', '$q',
function($http, $q) {
return ({foo: foo});
this.myObj = {};
function doSomething(param, callback){
param++;
callback(param);
}
function foo(param){
doSomething(param, function(responce){
this.myObj.myParam = responce;//'this' is undefined
});
}
});
Wie greife ich richtig darauf zu? Danke ...
Bitte verwenden Sie die Suche, bevor Sie eine neue Frage stellen. –
Werde das nächste Mal besser versuchen ... Ja, als du! –