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

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -