I'm facing an issue with extracting entire objects from a multiselect dropdown that I have included in my angular template.
Although I am able to successfully retrieve IDs, I am struggling to fetch the complete object. Instead, in the console, it displays [object Object]
.
<!-- Select All option -->
<div class="form-group row">
<label class="col-form-label col-lg-3">Roles:</label>
<div class="col-lg-9">
<select id="applicationModuleFormSelect" name="applicationModuleFormSelect" [(ngModel)]="amf" class="form-control multiselect-select-all" multiple="multiple" data-fouc>
<option *ngFor="let amf of appModuleForms;" [value]="amf">{{amf.title}}</option>
</select>
</div>
</div>
<!-- /select All option -->
onSubmit() {
var selectedAppForms = $('#applicationModuleFormSelect').val();
console.log((selectedAppForms));
}
It is evident in the code where I have written [value]="amf"
, but unfortunately, the output in the console looks like this:
[![enter image description here][1]][1]
Even when applying JSON.stringify
, the results are consistent:
["1: Object","3: Object"]
Any help or suggestions are greatly appreciated. Thanks in advance!