I'm working on Front end Code
<ng-select formControlName="constituencyId" placeholder="Select Constituency" (change)='onContituencyChanged($event)'> >
<ng-option *ngFor="let op of this.getAllConsituencies"
[value]="op.id"
[attr.typename]="op.constituencyTypeName" >
{{op.code}} {{op.name}}
</ng-option>
</ng-select>
<label>Constituency Name</label>
Now, let's see the Backend code
onContituencyChanged(evt: any) {
console.log("targeted obj of constituency. " ,evt);
}
Currently, I am only extracting the value of the selected item instead of the complete targeted event.
My goal is to implement two operations with ng-select dropdown list in Angular - firstly, upon change, I wish to access the custom attribute added to the dropdown for some specific logic execution.