angularify / angular-semantic-ui

[WiP] AngularJS native directives for Semantic UI
http://angularify.github.io/angular-semantic-ui
MIT License
383 stars 87 forks source link

Dropdown key,value support #29

Closed iberflow closed 9 years ago

iberflow commented 9 years ago

I'm trying to populate the dropdown from an array of objects. I need the value to be the object ID and the title the object label. How do I achieve this?

jspdown commented 9 years ago

The current version of angular-semantic-ui doesn't support that. If you really want to achieve it, you need to edit dropdownGroup directive and add a new attribute to store the value (in our case, the object ID). Something like that:

<dropdown-group value="12345">Title</dropdown-group>

Last thing to do is to update the click handler:

element.bind('click', function () {
    DropDownController.update_title(scope.item_value);
});
jspdown commented 9 years ago

I merged your pull request. Thanks @Kurmaev