How to remove row from grid in angularjs -


i using angularjs.

i making simple $http.delete method call in api deleting row grid table:

my controller looks below:

 $scope.removerow = function(detail, index){                         var delres =  $http.delete($scope.appurl + detail.id);         delres.success(function (data, status, headers, configs) {             console.log(data);             delete $scope.appdetails[index].id;         });         delres.error(function (data, status, headers, configs) {             console.log(data);         });      }; 

now, api call works fine can still see record in grid on ui. when refresh page can not see. reason.

please help.

it seems me deleting id property of appdetails's index row.

try deleting whole appdetails[index].

if not problem can try using $scope.$apply() proper checks before calling it. works on async calls.

if you're creating angularjs service (such sockets) should have $scope.$apply() anywhere fires callback.

$scope.$apply() should occur close async event binding possible. https://github.com/angular/angular.js/wiki/when-to-use-$scope.$apply()


Comments

Popular posts from this blog

java - Incorrect order of records in M-M relationship in hibernate -

ruby - Net::HTTP extremely slow responses for HTTPS requests -

c++ - Boost Spirit Parser with a vector of three strings compiling into a struct, adapt not working -