簡體   English   中英

ng-model在angularjs的ui-select中不起作用?

[英]ng-model is not working in ui-select in angularjs?

ng-model="customer.selected"無法正常工作。 它沒有顯示任何客戶

<p>Selected: {{customer.selected}}</p>
     <div class="col-md-3">          
       <ui-select ng-model="customer.selected" theme="select2" class="input-md">
        <ui-select-match placeholder="Select a Customer">{{ $select.selected.name }}</ui-select-match>
          <ui-select-choices repeat="customer in customers | propsFilter: {name: $select.search}">
           <div ng-bind-html="customer.name | highlight: $select.search"></div>
          </ui-select-choices>
        </ui-select>
    </div>

像這樣在控制器中將模型值設置為默認值,然后它應該起作用。

$scope.customer = {};
$scope.customer.selected = {};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM