Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add icon to ion-option in ion-select

is it possible to add icon to ion-option in ion-select? something like

<ion-select  name="type">
        <ion-option value="bar"><ion-icon name="stats"></ion-icon>Bar</ion-option>
        <ion-option value="pie"><ion-icon name="pie"></ion-icon>Pie</ion-option>
      </ion-select>
like image 631
mohamad rabee Avatar asked May 22 '17 18:05

mohamad rabee


People also ask

How do I add an image to ion select?

Solution. It is not possible to add images in ion-select-option but you can achieve the same thing by your own by : create a page and make normal ion-list with a ngfor and inside each item put an image and before it a radio button for single choice or checkbox for multichoice.

How do you use ion select option?

A select should be used with child <ion-select-option> elements. If the child option is not given a value attribute then its text will be used as the value. If value is set on the <ion-select> , the selected option will be chosen based on that value.

How do you get the value from ION select option?

place will be the selected item when the ionChange event is triggered. Use (ngModelChange) instead of (click) event. whenever the model value changed the ngModelChange will automatically call the relative function.


1 Answers

hey you can try this ...

this worked for me .. Check out this site : https://www.alt-codes.net/star_alt_code.php

i used this code : ✰

so my code looks like this :

<ion-item>
            <ion-label>Member's Overall Rating</ion-label>
            <ion-select [(ngModel)]="newreport.memberstatus">
            <ion-option value="&#10032;">&#10032;</ion-option>
            <ion-option value="&#10032;&#10032;">&#10032;&#10032;</ion-option>
            <ion-option value="&#10032;&#10032;&#10032;">&#10032;&#10032;&#10032;</ion-option>
            <ion-option value="&#10032;&#10032;&#10032;&#10032;">&#10032;&#10032;&#10032;&#10032;</ion-option>
            <ion-option value="&#10032;&#10032;&#10032;&#10032;&#10032;">&#10032;&#10032;&#10032;&#10032;&#10032;</ion-option>
            </ion-select>
            </ion-item>

the result is this (screenshot on my phone cause im testing on my phone) :

screenshot of what the results would be like

like image 128
Prophet Avatar answered Oct 26 '22 03:10

Prophet