I have a navbar containing 4 words (A, B, C, D), when I went to the database and I delete for example (A) by its id, the word (A) deletes in menu but its contents remains displayed, I want deleted also its contents and the page went automatically to the login, how to finish this
controller.js:
User.AccessRole({id:this.user.userId},function (res, req) {
$scope.listmenu=res;
console.log( $scope.listmenu);
//$scope.listmenu.id=remove(listmenu, id);
});
config.js:
.state('aaaa', {
url: "/aaaa",
controller: "aaaa",
templateUrl: "views/aaaa/aaaa.html",
data: { pageTitle: 'aaaa' },
resolve: {
loadPlugin: function ($ocLazyLoad) {
return $ocLazyLoad.load([
'views/aaaa/aaaa.js',
'sweet_alert',
'datatables_lazy',
'fff'
]);
}
},
data: {
role: [roles.SuperAdministrateur,roles.Administrateur,roles.Agent], pageTitle: 'aaaa'
}
})
app.js:
.run(['authService', function (authService) {
authService.fillAuthData();
}])
.run(["$rootScope", "authService", "$state", '$window', function ($rootScope, authService, $state, $window) {
$rootScope.$on("$stateChangeSuccess", function (event, toState) {
var authorizedRoles = toState.data.role;
console.log("from app");
console.log(authorizedRoles);
// authService.authentication.isAuth=true;
if (authService.authentication.isAuth && authService.isAuthorized(authorizedRoles)) {
if (authService.isAuthorized(authorizedRoles) || authorizedRoles === undefined || authorizedRoles.remove(id)) {
console.log("You are authorized");
} else {
$state.go('error.500');
authService.logOut();
}
} else {
$state.go('login');
// $(window).bind('beforeunload', function(){ authService.logOut(); });
}
});
topnavbar.html:
<ul class="clearfix" style="margin-top: 0px">
<span ng-repeat="item in listmenu" >
<li> <a href="#!{{item.MenuLink}}" ng-if="item.menu_id!=7"
class="w3-bar-item w3-button w3-border-right"><center>{{item.designation_menu}}</center></a>
</li>
</span>
</ul>