In ng show can we use if condition

46 Views Asked by At

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>
1

There are 1 best solutions below

3
Kishore Renangi On

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>