Personally, I use ternary operators in these directives, and it works well. For the required ng:
<input type="text" ng-required="(user.name == '' ? 'true' : 'false')" ng-model="user.nickname"/>
In this example, if the username field is blank, the alias field becomes REQUIRED.
source share