Friday, September 29, 2017

How to get selected value index dynamically using ng-options in angularjs

I am using select, in which I require selected value and dynamically created index (I don’t want to set default to [0] index)
How it can be done.

        <div class="input-label">
          Select Mobile
        </div>

        <select ng-model="mobile" ng-options="mobile as mobile.value for mobile in editContactModalData.phoneNumbers"></select>
      </label>

    Above is select option and below is input box where the selected value is set       


      <label class="item item-input item-stacked-label" ng-show="mobile">
        <input type="tel" maxlength="10" placeholder="mobile" ng-model="mobile.value">
      </label>

this is one modal and I want to show these changes of selected mobile in another modal

the second modal consist

  <span></span>

so in this in the place of [0] index i want to put dynamically selected value.

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/09/29/how-to-get-selected-value-index-dynamically-using-ng-options-in-angularjs/
via @lzomedia #developer #freelance #web

No comments:

Post a Comment