Jayanthi
Jayanthi

Reputation: 25

In ng show can we use if condition

My requirement is have to allow only the globals.currentUser.syllabus_id==3 to access the developement portfolio, if syllabus match then have to check for the mentioned role, if both syllabus and role match only the menu developement portfolio to be show other wise it should not show the menu.

<li
     ng-show="globals.currentUser.roleid==1 ||globals.currentUser.roleid==2 || globals.currentUser.roleid==4 || globals.currentUser.roleid==5 || globals.currentUser.roleid==10 || globals.currentUser.roleid==11">
 <a href=""><i class="fa fa-edit"></i>Development portfolio </a>
</li>

Upvotes: 0

Views: 46

Answers (1)

Kishore Renangi
Kishore Renangi

Reputation: 11

I suggest, write a function which does this check and returns a boolean and call that function from markup.

in controller

vm.isUserEligibleToSeeSomething = function() { return false; // true }

in markup

<li ng-show="vm.isUserEligibleToSeeSomething()"></li>

Upvotes: 1

Related Questions