Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.
Ben Scott edited this page Aug 5, 2015 · 8 revisions

Common Issues

ng-model not working with a simple variable on $scope

You cannot write:

<ui-select ng-model="item"> <!-- Wrong -->
  [...]
</ui-select>

You need to write:

<ui-select ng-model="item.selected"> <!-- Correct -->
  [...]
</ui-select>

Or:

<ui-select ng-model="$parent.item"> <!-- Hack -->
  [...]
</ui-select>

For more explanations, check ui-select #18 and angular.js #6199.

ng-bind-html gives me "Error: [$sce:unsafe] Attempting to use an unsafe value in a safe context"

You need to use module ngSanitize (recommended) or $sce:

$scope.trustAsHtml = function(value) {
  return $sce.trustAsHtml(value);
};
<div ng-bind-html="trustAsHtml((item | highlight: $select.search))"></div>

I get "TypeError: Object [...] has no method 'indexOf' at htmlParser"

You are using ng-bind-html with a number:

<div ng-bind-html="person.age | highlight: $select.search"></div>

You should write instead:

<div ng-bind-html="''+person.age | highlight: $select.search"></div>

Or:

<div ng-bind-html="person.age.toString() | highlight: $select.search"></div>

Or:

<div ng-bind-html="String(person.age) | highlight: $select.search"></div>

How do I stop the drop-down from getting cut off by the bottom of my Bootstrap modal / container with overflow: hidden?

Add append-to-body="true" to the ui-select tag. See the ui-select directive wiki page.

Clone this wiki locally