Q: angularjs view not updating on data change I have this code on my controller:
angular.module('chatApp').
controller('MainUserList', ['$scope', '$state', '$http', 'AppData', '$localStorage', function ($scope, $state, $http, AppData, $localStorage) {
    var socket = AppData.getSocket();
    $http.get('http://localhost:3000/api/users').success(function(data){
        $scope.users = data;
    });  
    socket.on('X_USER_LOGIN', function(data){
        for(var x=0;x<$scope.users.length;x++){
            if($scope.users[x].id === data.id){
                console.log('doufn!');
                delete $scope.users[x];
                break;
            }
        }
    });
    socket.on('X_USER_LOGOUT',function(data){
        console.log(data.id+' has logged out!');
    });


    $scope.excludeUser = function(object){
        return object.id !== $localStorage.clientProfile.id;
    };
}]);

However when the event X_USER_LOGIN is fired, the console is displaying the string I want but the list on the view isnt updating.
From my code above, array member should be deleted right?
Here is my partial view:
<div class="panel widget-messages-alt">
<div class="panel-body">
    <div class="messages-list">
        <div class="message" ng-repeat="usr in users| filter:excludeUser">
            <img src="./images/avatar1.png" alt="" class="message-avatar">
            <a href="#" class="message-subject"><i class="fa" ng-class="usr.online===1?'fa-circle text-success':'fa-circle-o'"></i> {{usr.firstname + ' ' + usr.lastname}} ({{usr.username}})</a>
            <div class="message-description"> Sample last message
            </div> <!-- / .message-description -->
        </div> <!-- / .message -->
    </div> <!-- / .messages-list -->
</div> <!-- / .panel-body -->


Am I doing something wrong?

A: Okay I have the answer.
Since I am using socket.IO's function, I have to wrap the data deletion on $scope.apply function
Working code:
angular.module('chatApp').
controller('MainUserList', ['$scope', '$state', '$http', 'AppData', '$localStorage', function ($scope, $state, $http, AppData, $localStorage) {
    var socket = AppData.getSocket();
    $http.get('http://localhost:3000/api/users').success(function(data){
        $scope.users = data;
    });  
    socket.on('X_USER_LOGIN', function(data){
        for(var x=0;x<$scope.users.length;x++){
            if($scope.users[x].id === data.id){
                console.log('doufn!');
                /*change is here*/
                $scope.$apply(function(){
                   delete $scope.users[x];
                });
                break;
            }
        }
    });
    socket.on('X_USER_LOGOUT',function(data){
        console.log(data.id+' has logged out!');
    });


    $scope.excludeUser = function(object){
        return object.id !== $localStorage.clientProfile.id;
    };
}]);

