Reputation: 74
I am working on dropdown with image in angularjs, i tried many solution but havent get any success.
My combo data is coming in json format with three elements id , image and value. These dropdown numbers are also dynamic as per number of rows are there in model.
Please share the solution for that.
Thanks you.
Upvotes: 1
Views: 11298
Reputation: 1214
Checkout a example at angularjs select option with custom format value
Hope it helps.
Upvotes: 0
Reputation: 101
<select ng-model="image_chosen">
<option ng-repeat="data in list" data-image="{{data.url}}" value="{{data.id}}">{{data.value}}</option>
<option value="">Choose a option</option>
</select>
Upvotes: 0
Reputation: 387
Please Try this it will work out,
<select ng-model="choice">
<option ng-repeat="item in itemsList" data-image="{{item.url}}">{{item.label}}</option>
<select>
Upvotes: 0
Reputation: 151
Write like this in option tag
ng-repeat="obj in xxxxComboData" data-image="{{obj.image}}"
Upvotes: -1