Neelabh Singh
Neelabh Singh

Reputation: 2678

ng-model is not working in ui-select in angularjs?

ng-model="customer.selected" is not working. It is not showing any customer

<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>

Upvotes: 0

Views: 643

Answers (1)

Narendra CM
Narendra CM

Reputation: 1426

Set the model value to default value in your controller like this and then it should work.

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

Upvotes: 1

Related Questions