Anil8753
Anil8753

Reputation: 2735

Empty select box with Ionic Angular ng-option

I am facing an issue with Angular and Ionic. I have the following snippet:

Controller:

app.controller('CatagoryItemsContoller', ['$scope', function($scope) {
  'use strict';

  $scope.stringArr = ["Yes","No","MayBe"];
  $scope.selectedItem = "Yes";

}]);

HTML:

<ion-view ng-controller="CatagoryItemsContoller">
    <div class="item item-input item-select item-margin">
        <div class="input-label">
            Pick
        </div>
        <select ng-model="selectedItem" ng-options="o as o for o in stringArr"></select>
    </div>
</ion-view>

I always get an empty select box. What is happening here?

Note: I am landing to this page via angular routing.

Upvotes: 2

Views: 281

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222582

It's ng-model not ng-modal

Change

From:

<select ng-modal="selectedItem" ng-options="o as o for o in stringArr"></select>

To:

<select ng-model="selectedItem" ng-options="o as o for o in stringArr"></select>

Working Plunker

Upvotes: 2

Related Questions