Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Using an array of objects with ng-model #98

Open
@gaboAcosta

Description

@gaboAcosta

Hello, I have a angular-ui select2 like this:

<label>Categoría(s)</label>
        <select ui-select2 ng-model="servicio.categoria"  data-placeholder="Seleccione las categorias" multiple class="photo_select">
            <option ng-repeat="category in categories" value="{{category}}">{{ category.nombre }}</option>
        </select>

The model is exactly this:

{"id":186,"nombre":"Test","categoria":[{"id":11,"nombre":"Bodas"},{"id":12,"nombre":"Grupos"}],"descripcion":"<p>desc<\/p>","fotos":["1385525_10152045795152009_436566997_n.jpg","1912-so-much-win_inline.jpg"],"archivos":["aaa.txt","robots.txt"],"orden":null}

And the option list in the controller is this:

[{"id":11,"nombre":"Bodas"},{"id":12,"nombre":"Grupos"}]

But it doesn't seem to be pairing them correctly, as far as I can see that's the way I should do it, if not, I swear I haven't found how :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions