All the courses
Course information
👉 Assignment example of using Forms in Angular (video)+ codes. 👉 Project using Form : codes.
Because your app is SVC (single-view-component) → when you submit a form, how can web do it? → that's why angular need a special "things" for forms.
Left: HTML form → Right: key-value object can be submitted with the form.
Everything you wanna do → do it in the template ← template-driven!!!!
The form here don't make any HTML request. ← <form>
has no attribute!
// make sure
// app.module.ts
import { FormsModule } from '@angular/forms';
@NgModule({
imports: [
FormsModule // with this, angular will auto create form based on <form> in html
]
})
export ...
Angular doesn't recognize auto elements of <form>
(label, input,...) because there may be some inputs which aren't served when submitting a form (their functions are different from a function of a form but they're inside <form>
) → ==need to tell angular which ones to be extra controlled?==