Issue
I have an Angular admin project, in this project the user can add/delete users in the data base. I have a list of all users showing at the same page as are the delete button and the add new user fields; so, when I delete/add I want this new user to show immediately at the screen or to vanish of the screen (in the case of delete).
Here is my controller of the add user:
(function(){
angular.module("agendaRaiar").controller('findUserController', ['$scope','UserWsService', function($scope, UserWsService){
$scope.passTheScope = function(user){
$scope.objectUser = user; //isso é feito para ter o id dentro do deletecontroller
}
$scope.getUsersAtParse = function(){
UserWsService.getUsersAtParse().then(function(resultArray) {
$scope.users = resultArray;
console.log(resultArray);
});
};
}]);
}());
How can I accomplish this?
Solution
Have you tried using $scope.user.push(resultArray)?
this will add the newly created user in your view. for delete, try on $scope.user.splice
$http.post(...).then(function(response){
$scope.myarrayObj.push(response);
});
Answered By - redanesc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.