0

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

1 Answer 1

0

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:

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.