<form role="form" #form="form" (ng-submit)="submit(form.value)">
<input type="text" placeholder="Enter your name" ng-control="name">
<input type="text" placeholder="Enter your email" [(ng-model)]="email">
<button>Submit</button>
</form>
What is the diff b/w using ng-model and ng-control? When to use each of them?
ngControl
, ngModel
and ngFormControl
are selectors for NgControlStatus
directive, so there's no difference between them...
NgControlStatus is Directive automatically applied to Angular forms that sets CSS classes based on control status (valid/invalid/dirty/etc).
NgFormControl
is directive that binds input field in the template to the Control
class that is used to programmatically create form fields.
NgFormControl Binds an existing Control to a DOM element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With