空选择框与离子角ng选项

时间:2021-07-31 22:58:56

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:

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.

注意:我将通过角路径到达这个页面。

1 个解决方案

#1


2  

It's ng-model not ng-modal

ng-model不是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

工作恰好

#1


2  

It's ng-model not ng-modal

ng-model不是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

工作恰好