Dynamically alter options in mdb-select


Topic: Dynamically alter options in mdb-select

starrcompanies asked 6 years ago

I have the following in my angular html component –

<select name="alaeCoverage" id="alaeCoverage" formControlName="alaeCoverage" class="form-control browser-default custom-select"><option value="Covered 100%">Covered 100%</option><option value="Pro-Rata">Pro-Rata</option>

<option value="ALAE Eroding" *ngIf="f.eligibleForLossRatingOrRule15.value===true">ALAE Eroding</option>

<option value="100% Reimbursed" *ngIf="f.eligibleForLossRatingOrRule15.value===true">100% Reimbursed</option>                  </select>

Is there a way to dynamically populate/alter the options in the mdb-select after initialization?  The above works fine in regular Angular, but when I convert to mdb-select using a dynamic collection, it doesn’t update based on ngIf.

 

Thanks!


Arkadiusz Idzikowski staff answered 6 years ago

Hello,

Do you use default select or mdb-select component? There is an instruction on how to update mdb-select options dynamically in our documentation. You can find it here: Update select options dynamically

Regards,

Arek


jiffe commented 5 years ago

Just a note that the "Update select options dynamically" section still exists in the side menu on the referenced page, but the example does not seem to exist anymore.


Arkadiusz Idzikowski staff commented 5 years ago

Thank you. This section is no longer needed in the new version of select component, we will remove it from menu.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 6.2.3
  • Device: desktop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No