I want to update the filter of an ng-repeat in my view and for that reason I am using a $scope variable to change in my controller. For example here is a json array of my objects that I'll iterate in my view:
[{
    "address" : "#/",
    "title" : "Home",
    "name" : "Home",
    "category": "loggedIn loggedOut"
}, {
    "address" : "#/logout",
    "title" : "Logout",
    "name" : "Logout",
    "category": "loggedIn"
}, {
    "address" : "#/register",
    "title" : "Register",
    "name" : "Register",
    "category": "loggedOut"
}, {
    "address" : "#/login",
    "title" : "Login",
    "name" : "Login",
    "category": "loggedOut"
}]
Which is assigned to $scope.menuLinks. I also hava a $scope.menuFilter = "loggedIn"; for the filtration.
Here is my view that I want to update: menu.html
<div ng-controller="MenuController as menuCtrl">
    <ul id="menu">
        <li ng-repeat="link in menuLinks | filter:menuFilter"><a
            href="{{link.address}}" title="{{link.title}}">{{link.name}}</a>    </li>
    </ul>
</div>
And here is my controller which changes the $scope.menuFilter:
 function LogoutController($scope, $http, $location) {
    var sessionkey = localStorage.getItem("sessionkey");
    $http({
        method : 'PUT',
        url : url + "/user/logout",
        headers : {
            'sessionkey' : sessionkey
        }
    }).success(function(data) {
        sessionkey = "";
        localStorage.setItem("sessionkey", sessionkey);
        $location.path('/');
        $scope.menuFilter = "loggedOut";
    });
 }
But when the LogoutController is called, the view does not change, I have to refresh the page in order to see the view changed. If I add $scope.$apply(); after $scope.menuFilter = "loggedOut"; then I get and error: [$rootScope:inprog] $digest already in progress
What am I doing wrong? How should I update the view after a $scope value is changed?
 
     
    