Himanshu kukreja
Himanshu kukreja

Reputation: 74

How to add image in dropdown in angularjs

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

Answers (4)

Lewis Hai
Lewis Hai

Reputation: 1214

Checkout a example at angularjs select option with custom format value

enter image description here

Hope it helps.

Upvotes: 0

Nikhil T Nair
Nikhil T Nair

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

Archana
Archana

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

Niralee Patel
Niralee Patel

Reputation: 151

Write like this in option tag

ng-repeat="obj in xxxxComboData" data-image="{{obj.image}}"

Upvotes: -1

Related Questions