0
I have a select I want to show a label
as default option, but it is appearing blank.
My select:
<div class="select">
<select (change)="calculaMes(mesEscolhido)" [(ngModel)]="mesEscolhido" name="selectMesEscolhido"
class="select-text">
<option class="dropdown-item" disabled selected value>Teste</option>
<option [hidden]="datasComMovimentacoes[x].data == mesEscolhido" *ngFor="let mes of datasComMovimentacoes;let x = index"
class="dropdown-item">{{mes.data}}</option>
</select>
<span class="select-highlight"></span>
<span class="select-bar"></span>
</div>
This is the result I have in my template:
And tag
<label>
?– hugocsl
To add a default value just add it to the model,
this.mesEscolhido = SUA OPCAO
in the ts file, the angular itself will find the value in the options list and select– edson alves