2016-11-14 15 views
2

我用模糊管理員來開發Web應用程序如何通過許可服務來隱藏菜單和路線

,我有服務檢查權限爲每個用戶

我怎麼可以在pages.module經許可服務隱藏菜單.js和LVS.module.js

ps。我可憐的英語。

我的代碼

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, 
      }, 
     }); 
    } 

})(); 

回答

0

我發現這對githut藍色的管理問題

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

+0

一個潛在的解決方案的鏈接永遠是受歡迎的,但請[添加各地的聯繫上下文(http://meta.stackoverflow.com/ a/8259/169503),所以你的同行們會有一些想法是什麼,爲什麼它在那裏。如果目標網站無法訪問或永久離線,請始終引用重要鏈接中最相關的部分。考慮到_barely不僅僅是一個鏈接到外部網站_是一個可能的原因[爲什麼和如何刪除一些答案?](http://stackoverflow.com/help/deleted-answers)。 –