Athit Upakan Athit Upakan - 12 days ago 12
AngularJS Question

How to hidden menu and route by permission service

I use Blur Admin to Develop Web App

and I have Service to check permission for each user

how i can hidden menu by permission service in pages.module.js and LVS.module.js

ps. my poor English.

My code

App.js:

'use strict';

var app = angular.module('BlurAdmin', [
'ngAnimate',
'ui.bootstrap',
'ui.sortable',
'ui.router',
'ngTouch',
'toastr',
'smart-table',
"xeditable",
'ui.slimscroll',
'ngJsTree',
'angular-progress-button-styles',

'BlurAdmin.theme',
'BlurAdmin.pages',
'ngRoute',
'ngCookies',
])
;


pages.module.js:

(function () {
'use strict';

angular.module('BlurAdmin.pages', [
'ui.router',

'BlurAdmin.pages.dashboard',
'BlurAdmin.pages.ui',
'BlurAdmin.pages.components',
'BlurAdmin.pages.form',
'BlurAdmin.pages.tables',
'BlurAdmin.pages.charts',
'BlurAdmin.pages.maps',
'BlurAdmin.pages.profile',

'BlurAdmin.pages.Base',
'BlurAdmin.pages.Common',
'BlurAdmin.pages.Home',
'BlurAdmin.pages.MSS',
'BlurAdmin.pages.LVS',
'BlurAdmin.pages.SHS',
'BlurAdmin.pages.OTS',
'BlurAdmin.pages.TCS',
])
.config(routeConfig).run(run);

/** @ngInject */
function routeConfig($urlRouterProvider, baSidebarServiceProvider) {
$urlRouterProvider
.otherwise('Login');

}
})();


LVS.module.js:

(function () {
'use strict';

angular.module('BlurAdmin.pages.LVS', [
])
.config(routeConfig);

/** @ngInject */
function routeConfig($stateProvider) {
$stateProvider
.state('LVS', {
url: '/Leave',
template : '<ui-view></ui-view>',
//controller: 'LeaveManagementCtrl',
abstract: true,
title: 'Leave Management',
sidebarMeta: {
icon: 'ion-android-calendar',
order: 30,
},
resolve: {
user: function (AuthService, $q) {
var d = $q.defer();
if (AuthService.isAuthenticated()) {
// I also provide the user for child controllers
d.resolve(AuthService.UserDomain());
} else {
// here the rejection
d.reject('not logged');
}
return d.promise;
}
},
})
.state('LVS.LeaveList', {
url: '/List',
templateUrl: 'app/pages/ESS-TA/LeaveManagement/LeaveList.html',
controller: 'LVSCtrl',
title: 'Leave List',
params: {
obj: null,
},
sidebarMeta: {
order: 10,
},
})
.state('LVS.LeaveReport', {
url: '/Report',
templateUrl: 'app/pages/ESS-TA/LeaveManagement/LeaveReport.html',
title: 'Leave Report',
sidebarMeta: {
order: 30,
},
});
}

})();

Answer

i found this on githut blue admin issue

https://github.com/akveo/blur-admin/issues/141

Comments