ng-required, ng-pattern, and form.$invalid gate submits in template-driven legacy forms.
Important interview questions and answers
- Q: Why does this matter?
A: ng-required, ng-pattern, and form.$invalid gate submits in template-driven legacy forms.
Self-check
- Summarize Forms and validation in one sentence.
- What would you try next in the playground?
Challenge
Forms and validation hands-on
- Edit the default code.
- Click Run in browser.
- Confirm preview or terminal output.
Done when: preview or terminal matches the lesson goal.
Challenge
Invalid email submit
- Submit empty email—terminal shows
valid:false. - Enter a valid email and submit again.
Done when: terminal shows valid:false then valid:true.
Interview prep
- How block invalid submit?
Use
ng-disabled="form.$invalid"or checkform.$validinside ng-submit handler.