AngularJS: Z fabryki, jak mogę nazwać inną funkcję
Czy muszę przenieść funkcję getTemplates z powrotu lub co?
Przykład: Nie wiem, co zastąpić „XXXXXXX” (próbowałem „this / self / templateFactory” itd ...):
.factory('templateFactory', [
'$http',
function($http) {
var templates = [];
return {
getTemplates : function () {
$http
.get('../api/index.php/path/templates.json')
.success ( function (data) {
templates = data;
});
return templates;
},
delete : function (id) {
$http.delete('../api/index.php/path/templates/' + id + '.json')
.success(function() {
templates = XXXXXXX.getTemplates();
});
}
};
}
])