CraZyDroiD
CraZyDroiD

Reputation: 7105

ionic dropdown select issue

i'm new to ionic and i have this problem about ionic dropdown select component.I've implemented a dropdown and i want to display the option i selected in a label.How can i do this? at the moment i only can select a option and that's it. i want to show my selected option in a label.

enter image description here

Here i want to display the option i selected in "select your bank label".

This is how i implemented my dropdown select component

<label><h4><b>Bank Name*</b></h4></label>



 <div class="list">
        <div class="item item-input item-select">
            <div class="input-label">
                Select your Bank
            </div>
            <select>
                <option>Bank1</option>
                <option>Bank2</option>
                <option>Bank3</option>
            </select>
        </div>
    </div>

Upvotes: 1

Views: 12035

Answers (1)

JakeSidSmith
JakeSidSmith

Reputation: 933

Add a model to your select. This will create a variable on scope that you can use elsewhere.

<select ng-model="myVariable">

In your controller you can set a starting value.

$scope.myVariable = 'Hello, world!';

Then you can display this in your HTML like so.

<div>{{myVariable}}</div>

I suggest you do some reading into ionic framework and angular js documentation. :)

Upvotes: 7

Related Questions