1
我有一個菜單或部分只對某些用戶可見。我在我的數據庫中有角色用戶,角色admin1和角色admin2。根據用戶的角色在菜單中顯示不同的內容
例如,如何才能使用戶和admin2僅顯示Category 2?
{
"name": "Jack",
"fname": "Daniel",
"roles": [
"ROLE_USER",
]
}
{
"name": "Rico",
"fname": "Phil",
"roles": [
"ROLE_ADMIN1",
]
}
{
"name": "Admini",
"fname": "Strator",
"roles": [
"ROLE_USER",
"ROLE_ADMIN2"
]
}
我的代碼:
<ion-item class="item-stable animsvdj" ng-click="toggleGroup(group)" ng-class="{active: isGroupShown(group)}">
<i class="icon" ng-class="isGroupShown(group) ? 'ion-android-contacts' : 'ion-android-contacts'"></i>
Category
</ion-item>
<ion-item class="item-accordion menu-border" ng-show="isGroupShown(group)" ui-sref="menu.disponibilites" menu-close=""><i class="ion-ios-calendar-outline menu-icon"></i> Category 1</ion-item>
<!-- Part that should be visible only by admin -->
<ion-item class="item-accordion menu-border" ng-show="isGroupShown(group)" ui-sref="menu.organiseVisite" menu-close=""><i class="ion-ios-time-outline menu-icon"></i> Category 2</ion-item>
<!-- Part that should be visible only by admin -->
<ion-item class="item-accordion menu-border" ng-show="isGroupShown(group)" ui-sref="menu.trouverUnJeune" menu-close=""><i class="ion-ios-eye-outline menu-icon"></i> Category 3</ion-item>
謝謝:)