Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
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>
<form>
ng-form
<div ng-form="name1"> <input name="input1" ng-model="data.firstName" required /> <input name="input2" ng-model="data.lastName" required /> </div>
For more information:
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.