angularjs-dropdown-multiselect icon indicating copy to clipboard operation
angularjs-dropdown-multiselect copied to clipboard

selected model doesn't reflect the options objects

Open Planet910 opened this issue 8 years ago • 3 comments

In the example in the doc when you select an item from the dropdown the selected-model array is filled with the corresponding object inside the options array but when I use it in the selected-model array is inserted an object with only the id property. I need the full object (also with the label property) to be inserted in the selected-model, is there a way to do it?

Selected Model: [{"id":"AL"},{"id":"AK"}]

options:

$scope.example14data = [{
        "label": "Alabama",
            "id": "AL"
    }, {
        "label": "Alaska",
            "id": "AK"
    }, {
        "label": "American Samoa",
            "id": "AS"
    }, {
        "label": "Arizona",
            "id": "AZ"
    }, {
        "label": "Arkansas",
            "id": "AR"
    }]

Planet910 avatar May 03 '17 08:05 Planet910

I have the same problem in my project.

Makanz avatar May 16 '17 10:05 Makanz

Me too

GiuliaBusnelli avatar May 31 '17 07:05 GiuliaBusnelli

Copying both the label and the id into the selected model appears to be the default behavior in the new versions of 2.0 beta.

If you are using version 1.x I was able to successfully force this behavior by setting externalIdProp to an empty string (aka { externalIdProp : '' } ) in extra-settings.

m3shark avatar Jun 30 '17 14:06 m3shark