标签:ng-model object color span blog sel anjularjs model 添加
html中
<select name="book_classify" class="all_list_btn" ng-model="selectedBook" ng-options="x.id as x.bookName for x in bookList" ng-change="bookSelect(selectedBook)">
</select>
js中
$scope.bookList = data.objectList; //[{bookName:"哈哈",id:23},{bookName:"嘿嘿",id:25}]
$scope.bookList.unshift({"bookName":"全部书籍"}); //在开始位置添加一行数据
$scope.selectedBook=$scope.bookList[0].id; //设置默认值为第一个
$scope.bookSelect=function(bookid){ console.log(bookid) }
标签:ng-model object color span blog sel anjularjs model 添加
原文地址:http://www.cnblogs.com/liter7/p/6122649.html