need to hide 1st value in drop-down box and display rest of the values using angular .drop-down values will come from backend response
Ex : drop-down contains below values .here I need to hide mango and display rest values
Mango
Apple
Orange
need to hide 1st value in drop-down box and display rest of the values using angular .drop-down values will come from backend response
Ex : drop-down contains below values .here I need to hide mango and display rest values
Mango
Apple
Orange
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Deepak RawatRank #646 · 3.7K reputationPosted Jun 29, 2023, 2:03 PM EDT
In your component code, retrieve the dropdown values from the backend response and assign them to a variable. Let's assume you have the following array of values:
dropdownValues: string[] = ['Mango', 'Apple', 'Orange'];Create a new variable to store the filtered dropdown values, excluding the first value:
filteredDropdownValues: string[] = this.dropdownValues.slice(1);In your template, bind the
filteredDropdownValuesvariable to the dropdown element usingngFor:the first value, "Mango," is excluded from the
filteredDropdownValuesarray, and the remaining values are displayed in the dropdown box.