You tried to use lazy evaluation of expressions like disabled || someAction() disabled || someAction() ?
Suppose I defined something like this in the controller:
$scope.disabled = true;
Then I can disable the link and apply inline styles as follows:
<a data-ng-click="disabled || (GoTo('#/employer/'))" data-ng-style="disabled && { 'background-color': 'rgba(99, 99, 99, 0.5)', }">Higher Level</a>
Or better yet, disable the link and apply the class as follows:
<a data-ng-click="disabled || (GoTo('#/employer/'))" data-ng-class="{ disabled: disabled }">Higher Level</a>
Note: you will have class="disabled" applied to the DOM element by this statement.
At this point, you just need to handle what you do with GoTo() . In my case, it is as simple as redirecting to a bound state:
$scope.GoTo = function (state) { if (state != undefined && state.length > 0) { $window.location.hash = state; } };
Instead of limiting ngDisabled you are limited by what you decide to do.
Using this technique, I have successfully applied permission level checking to enable or disable user access to a specific part of my module.
Simple plunker to show point
iiminov Aug 11 '15 at 15:35 2015-08-11 15:35
source share