javascript - Binding the scope with side menu does not work - ionic -


i want show 2 different ion-list on menu according user "role" in app.

app.js

  .state('app', {     url: '/app',     abstract: true,     cache: false,     templateurl: 'templates/menu.html',     controller: 'appctrl'   }) 

appctrl

.controller('appctrl', function($scope) {   // example   $scope.user = {     name: "example",     role: "client"   }; }) 

menu.html

     <ion-list ng-if="user.role == 'manager' ">         <ion-item menu-close href="#/app/search">           manager         </ion-item>         <ion-item menu-close href="#/app/songbook">            item         </ion-item>       </ion-list>        <ion-list ng-if="user.role == 'client' ">         <ion-item menu-close href="#/app/search">           client         </ion-item>         <ion-item menu-close href="#/app/search">           item b         </ion-item>       </ion-list> 

and issue not render ion-list ! empty!
seems me angular not binding "scope.user" ideas?

is controller' range contains post html code?

 <ion-list ng-if="user.role == 'manager' "> 

if controller includes list code,

then try avoid array first ,

$scope.user_role == 'manager' in controller,

ng-if="user.role == 'manager' in html.

as far know ,if insert xxx.html large controller, using array correct(if not ,data can bot reached inserted html file)

anyway. did try whether functions when avoid array, if not, reason must range of angularjs not reach post html code


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -