I don't know if this is a stupid question. But I want a input field with a type number
to have a default value 1 when the page opens. I set the value
as 1 but, it didn't change anything and the input field is still empty. What should I add to fix it?
<mat-form-field appearance="outline">
<mat-label>Amount</mat-label>
<input matInput type="number" [(ngModel)]="WorkItemSelection.CopyQuantity" name="CopyQuantity" value="1">
</mat-form-field>
CodePudding user response:
No need for value="1"
. Just in your .ts
do this:
ngOnInit() {
WorkItemSelection.CopyQuantity = 1;
}