我自己写了一个filter 代码如下:
app.filter('selected', function() {
return function(input, value) {
var out = "";
if(input == value){
out = "selected";
}
return out;
};
});
页面代码如下:
<select class="form-control input-sm" style="width: 60px;">
<option {{data.page.pageSize|selected:5}} >5</option>
<option {{data.page.pageSize|selected:10}} >10</option>
<option {{data.page.pageSize|selected:20}} >20</option>
<option {{data.page.pageSize|selected:50}} >50</option>
</select>
但是现在这样写不起作用,pageSize是任何值的时候都没有效果。 哪位大神指教下谢谢了!
漂亮男人2017-05-15 17:05:19
要不别用filter
了,这么改改?
<select class="form-control input-sm" style="width: 60px;">
<option ng-selected="data.page.pageSize === 5">5</option>
<option ng-selected="data.page.pageSize === 10" >10</option>
<option ng-selected="data.page.pageSize === 20" >20</option>
<option ng-selected="data.page.pageSize === 50" >50</option>
</select>