The success function of a $http.put
doesn\'t have access to the this
scope of the service it\'s being called inside. I need to update a property of the
Create a closure over a variable (often called that
) that is assigned to this
so that your callback functions will have access to your service object:
app.service('CatalogueService', function($rootScope, $http) {
var that = this;
...
).success(function(data,status,headers,config) {
that.items.push(data);
Here is a Plunker that uses $timeout instead of $http to demonstrate.