2016-01-31 23 views
2

我正面臨Angular和Ionic的問題。我有下面的代碼片段:帶離子角的空選擇框ng-option

控制器:

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> 

我總是得到一個空的選擇框。這裏發生了什麼?

注:我通過角度路由登陸到此頁面。

回答

2

這是NG-模式沒有NG-模式

變化

來源:

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

要:

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

工作Plunker

+0

已更正,但同一個空的選擇框 – Anil8753