0
Inside my form, there is a select, where I choose an option, in this case I choose a user.
<div class="form-row">
<div class="form-group col-md-5">
<label for="usuario">ID usuário</label>
<select name="usuario" id="usuario" class="form-control usuario" formControlName="id_usuario">
<option value="{{ u.id_usuarios }}" *ngFor="let u of usuarios" >{{ u.id_usuarios }} - {{ u.login }}</option>
</select>
<div class="small" *ngIf="!usuarioPermissoesForm.controls['id_usuario'].valid && usuarioPermissoesForm.controls['id_usuario'].touched"> O ID usuário não pode ficar em branco!</div>
</div>
</div>
Below this select, you have an input, which will change the value within it as the user chosen in select.
<div class="form-row">
<div class="form-group col-md-5">
<label for="id_perfil">ID Perfil</label>
<input type="text" class="form-control" id="id_perfil" formControlName="id_perfil">
</div>
</div>
I’m getting the tag data from Formbuilder, inside the component. I searched and saw that I could use (change), but I can’t pass id, example:
<select name="usuario" id="usuario" class="form-control usuario" formControlName="id_usuario" (change)="atualizar(u.id_usuarios)">
<option value="{{ u.id_usuarios }}" *ngFor="let u of usuarios" >{{ u.id_usuarios }} - {{ u.login }}</option>
</select>
Does anyone have any idea how to solve?