我无法获得 select2 的值。这是我的代码:
<select id="categoryId" class="category"
ng-model="selectedCategory"
ng-options="selectedCategories.name for selectedCategories in categories"
ng-change="selectedCategory()">
<option></option>
</select>
在我的控制器中,我写了这个:
.....
function initializeSelect2 (){
$category.select2({
allowClear: true
});
}
$scope.selectedCategory = function (){
console.log('selectCategory: '+ $scope.selectedCategory);
}