Data list is no longer displayed

0

I have a problem, when visualizing the data assigned to a specific type of role, the data of the others are no longer displayed, the field is set. I have the following:     // Load the Role and the associated permissions according to the ID

  $scope.loadPermissionFromRoleList = function(index){
    $scope.role = $scope.roles[index];
    permissionsTmp = new Array();
    for(i=0; i<$scope.permissions.length; i++){
        var isOut = true;
        for(j=0; j<$scope.role.permissions.length; j++){
            if($scope.permissions[i].name == $scope.role.permissions[j].name){
                isOut = false;
            }
        }
        if(isOut)
            permissionsTmp.push($scope.permissions[i]);
    }
    $scope.permissions = permissionsTmp;
    $scope.resetMessage();
}

Inside the view

  <li data-ng-if="isPermited('ROLE_PERMISSION')"><a href="/#myModalRolePermission" data-toggle="modal" data-backdrop="static" title="" data-ng-click="loadPermissionFromRoleList($index)">Gestionar permisos</a></li>
    
asked by Carmen A. 30.03.2017 в 21:42
source

1 answer

0

You are overwriting $scope.permissions with permissionsTmp , the second you see that $scope.loadPermissionFromRoleList , only contains the permissions of the previous role.

Save permissionsTmp in a different variable so you do not erase your original permission list, for example:

$scope.currentPermissions = permissionsTmp;
    
answered by 31.03.2017 в 21:55