angularjs - How to access $scope from $resource -


i need splice array on success. how call out $scope.list in order remove item list array? how should or there better way? bubbling "update" or something?

var phonecatservices = angular.module('phonecatservices', ['ngresource']);     var urlbase = 'http://example.com/api/';      function resourceerrorhandler(response) {          console.log("error");     }     function resourceresponsehandler(response) {         console.log($scope.list);          $scope.list.data.splice(index, 1);         console.log("success");     }     phonecatservices.factory('api_resource', ['$resource',       function($resource){         return $resource(urlbase+':api_resource/:id.json', {}, {           query: {method:'get', isarray:false},           save:{method:'post', isarray:false},           delete:{method:'delete', isarray:false, interceptor:{response:resourceresponsehandler, responseerror:resourceerrorhandler}},          });       }]); 

make $scope argument in functions , pass method call in controllers, or bundle in response object.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -