How can I pass a different parameter to the $event in the function?
<div class='col-sm'>
<label class="col-3 col-form-label">Origen</label>
<div class="col-4">
<select [(ngModel)]="dana" class="form-control"
(ngModelChange)="filterFor($event)"required>
<option *ngFor="let dano of danos"
[value]="dano.comment">{{dano.make}}
</option>
</select>
</div>
</div>
I am trying to send a specific parameter when calling the filterFor function:
<div class='col-sm'>
<label class="col-3 col-form-label">Origen</label>
<div class="col-4">
<select [(ngModel)]="dana" class="form-control"
(ngModelChange)="filterFor(dano.tipo)"required>
<option *ngFor="let dano of danos"
[value]="dano.comment">{{dano.make}}
</option>
</select>
</div>
</div>
Error Message:
Error TS2551: Property 'dano' does not exist on type 'ComunidadFiltracionesComponent'. Did you mean 'danos'? .
Do you have any idea how to format the parameter correctly so that it is accepted? Thank you in advance
Elaborating further:
I have an object with various parameters:
let car = [ {'make': 'Ford', 'comment': 'The vehicle has a heavy internal combustion engine....'}];
When a selection is made from the dropdown list (ngFor), we capture the comment variable based on the selected car make.
If I want to compare cars:
if (dana == 'The vehicle has a heavy internal combustion engine....'){
this.quality = 'good';
}
To determine which brand the customer has entered, I need to compare using the make variable instead of the lengthy comment. How can I achieve this?
if (dana == 'Ford'){
this.quality = 'good';
}
Check out the code on stackblitz :