Home  >  Q&A  >  body text

Show selected options on top of ng-select

I am using ng-select package to display dropdown list. I want to display the selected option at the top of the dropdown list. Is it possible? Any ideas?

P粉883223328P粉883223328427 days ago496

reply all(1)I'll reply

  • P粉302160436

    P粉3021604362023-09-11 10:10:32

    1. First, when you select an option, you can push it into an array
    2. Now you have two arrays, the selected options array and the original data array
    3. Assume they are originalArr and selectedArr
    4. Inside ng-select ng-option
    1. So you can show the selected item here and prevent the selected item Appears again in the drop-down list

    reply
    0
  • Cancelreply