ui-select icon indicating copy to clipboard operation
ui-select copied to clipboard

Filter members exclude the first select

Open exejutable opened this issue 11 years ago • 2 comments

In my app I am using angular ui-select displaying a list of members (array of objects).

It is working fine except one little issue:

I need take off the first ui-select (members in a team) of the second (extra members outside of a team)

SITUATION:

I create a edit form to edit a project. When i select a team the members load in members select.

Also i want to add extra members outside the team. I want to exclude the team members from the extra members list I try the next

filter: {id:'!'+selectedTeam.selected.members} | filter: $select.search track by member.id"

Also try other filters examples in skacoverflow but i can't do it, i wasted 5 hours in this

I create one example in

PLUNKER: http://plnkr.co/edit/HrKB046xNrJtZinyNYVN.

CODE:

    <div class="form-group">
        <label >Extra members</label>
        <ui-select multiple ng-model="test" theme="bootstrap" ng-disabled="" >
            <ui-select-match placeholder="Select person...">{{$item.name}}</ui-select-match>
            <ui-select-choices  repeat="member in members | filter: {id:'!'+selectedTeam.selected.members} | filter: $select.search track by member.id">
                <div ng-bind-html="member.name | highlight: $select.search"></div>
            </ui-select-choices>
        </ui-select>
    </div>

QUESTION:

How can take off the first select from the second?

exejutable avatar Nov 06 '15 14:11 exejutable

Hi, I think there is no single expression to handle your requirement. Creating a custom filter will help.

Please check this plunker fork.

http://plnkr.co/edit/KnXaI4CL2r4qsgYvph9E

Please ignore if i misunderstood your question.

koolshams avatar Nov 07 '15 15:11 koolshams

Closing as answered.

user378230 avatar Mar 16 '16 18:03 user378230