Category Archives: Required and NG-Required

WHAT IS THE DIFFERENCE BETWEEN REQUIRED AND NG-REQUIRED?

What is the difference between required and ng-required?

In HTML attribute required is to tell that field must be required in order for the form to be valid.

And it is not possible to write condition like required=”true” or required=”false”. It gives you a HTML error. This can be solved using Angular.

While, Using Angular attribute ng-required=”MyCondition” means ‘RequireFun(MyCondition)’ and sets the HTML attribute dynamically for you depending on your condition.