<ui-select multiple ng-model="content.categories" theme="bootstrap"name="category" on-select="isCategorySelected()" >
<ui-select-match placeholder="Select Category">
{{ $item.label }}
</ui-select-match>
<ui-select-choices repeat="category.value as category in categories | filter: {label: $select.search}">
<div ng-bind-html="category.label | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
This HTML code displays a multi select dropdown list with different categories.
$scope.categories = [
{ label: 'Action', value: 'action' },
{ label: 'Adventure', value: 'adventure' },
{ label: 'Comedy', value: 'comedy' },
{ label: 'Crime', value: 'crime' },
{ label: 'Faction', value: 'faction' },
{ label: 'Fantasy', value: 'fantasy' },
{ label: 'Historical', value: 'historical' },
{ label: 'Horror', value: 'horror' },
{ label: 'Mystery', value: 'mystery' },
{ label: 'Paranoid', value: 'paranoid' },
{ label: 'Philosophical', value: 'philosophical' },
{ label: 'Political', value: 'political' },
{ label: 'Realistic', value: 'realistic' },
{ label: 'Romance', value: 'romance' },
{ label: 'Saga', value: 'saga' },
{ label: 'Satire', value: 'satire' },
{ label: 'Science fiction', value: 'sciencefiction' },
{ label: 'Slice of Life', value: 'sliceoflife' },
{ label: 'Speculative', value: 'speculative' },
{ label: 'Thriller', value: 'thriller' },
{ label: 'Urban', value: 'urban' }
];
This is my JavaScript code that defines and populates the categories array.
$scope.content.categories = ['action'];
The above snippet should update the view when an item is selected, but it's not working properly. Please assist me in resolving this issue.