Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Preselect items by remote call in multiple select with object items doesn't work #404

@Thomas-Adams

Description

@Thomas-Adams

When trying to preselect a ui-select with multiple selected items, retrieved by a remote call, here $http service, the preselection is not set.

Example: The following does not work

$http.get(baseUrl + "/todotags/" + $scope.todoForm.id,{}).
    success(function(data, status, headers, config){
    $scope.todoForm.selectedTags  = data.records;           
 }).error(....);

Whereas setting it o an array of values that were fetched in a previous step does work:

$http.get(baseUrl + "/todotags/" + $scope.todoForm.id,{}).
    success(function(data, status, headers, config){
    $scope.todoForm.selectedTags  = [array of values previuosly fetched];           
 }).error(....);

In both case the remotely fetched data array and the fixed array are identical.

The corresponding HTML:

<ui-select multiple ng-model="todoForm.selectedTags" theme="bootstrap"  class="selectize-control">
    <ui-select-match placeholder="Select tags...">{{$item.text}}</ui-select-match>
    <ui-select-choices refresh-delay="110" repeat="tag in tags">
        {{tag.text}}
    </ui-select-choices>
</ui-select>

The array looks like this :

[
    {
        "id" : 9,
        "guid" : "09efa3cd-a5cd-4ea0-8a1c-83fc66860895",
        "text" : "Node.js",
        "createdAt" : "2014-11-14T10:06:52.000Z",
        "updatedAt" : null
    }, {
        "id" : 10,
        "guid" : "d765b48c-cb5a-49d8-af55-f70ebc5ff11f",
        "text" : "Sequelizer.js",
        "createdAt" : "2014-11-14T10:06:59.000Z",
        "updatedAt" : null
    }, {
        "id" : 11,
        "guid" : "c4b5f0dc-f11f-4bba-af47-584aa4e50c9b",
        "text" : "SQLite",
        "createdAt" : "2014-11-14T10:07:05.000Z",
        "updatedAt" : null
    }
]

Is there any possibility to make that work?

Cheerio Thomas

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions