angular - Dynamically changing validation requirements between form elements in directives angular - Dynamically changing validation requirements between form elements in directives angularjs angularjs

angular - Dynamically changing validation requirements between form elements in directives


The ng-required actually accept an expression, so there is no need to add {{ .. }} around the variable, otherwise the expression will be evaluated only once at a compile time.

In the textFormElement.html template, change this line:

ng-required="{{contentFragment.required}}"

to this:

ng-required="contentFragment.required"

Plunker: http://plnkr.co/edit/YLInikMU5Dl2hIpHPauy?p=preview

Hope this helps.