Angular - Template-Driven Forms
Given the following Angular template snippet, what will be the value of
And the component code:
If the user types "Alice" and submits, what is
submittedName after the form is submitted?<form (ngSubmit)="submitForm()" #myForm="ngForm"> <input name="name" [(ngModel)]="userName" required> <button type="submit" [disabled]="myForm.invalid">Submit</button> </form>
And the component code:
userName = '';
submittedName = '';
submitForm() {
this.submittedName = this.userName;
}If the user types "Alice" and submits, what is
submittedName?