I'm trying to add validations to my Angular js code. I'm using div tags instead of form. Do I need to change something in .js or should I just add required in my input tag
<input required type="..." name="..." ng-model="..." />
TIA
To use a <div>
element instead of a <form>
element, use the ng-form
directive:
<div ng-form="name1">
<input name="input1" ng-model="data.firstName" required />
<input name="input2" ng-model="data.lastName" required />
</div>
For more information: