Answers for "placeholder in angular 9 select with working required"

3

placeholder in angular 9 select

Set initial value of month = null in the component.ts and
add [(ngModel)]="month" in the select tag of component.html.

//component.ts
month = null;

//component.html
<form  #filter="ngForm" (ngSubmit)="filterta(filter)" style="display: flex;">
       <select name="month" [(ngModel)]="month" #month required>
                <option [ngValue]="null" [disabled]="true" >All</option>
                <option value="1">January</option>
       </select>
</form>
Posted by: Guest on January-07-2021
1

placeholder in angular 9 select with working required

<form role="form" class="form form-horizontal" (ngSubmit)="onSubmit()" #form="ngForm" ngNativeValidate>
    <div class="form-group row">
        <div class="col-xl-4 col-lg-6 col-md-12">
            <fieldset class="form-group">
                <label for="customSelect">Categories:</label>
                <select class="custom-select d-block w-100" id="Category" [(ngModel)]="Category" name="Category" required placeholder="d.ff">
                    <option hidden [value]=""  selected>Select one category </option>
                    <option *ngFor="let item of myBusinessList" [value]="item.id">{{item.name}}</option>
                </select>
            </fieldset>
        </div>
    </div>
    <button type="submit" class="btn btn-raised btn-danger">Save</button>
</form>
Posted by: Guest on January-07-2021
1

placeholder in angular 9 select with working required

[value]="" selected hidden
//add hidden with selected
Posted by: Guest on January-07-2021

Code answers related to "placeholder in angular 9 select with working required"

Code answers related to "Javascript"

Browse Popular Code Answers by Language