<div class="ng_wrapper"
data-ng-init="portfolios=[
{name: 'Portfolio 1', type: 'red'},
{name: 'Portfolio 2', type: 'red'},
{name: 'Portfolio 3', type: 'black'},
{name: 'Portfolio 4', type: 'black'}
]">
<ul>
<li data-ng-repeat="portfolio in portfolios | filter:type ">
{{ portfolio.name | uppercase }} - [{{ portfolio.type | lowercase }}]
</li>
</ul>
<select><option>red</option><option>black</option></select>
</div>
如何根据&#39;类型&#39;进行过滤选择?当我选择红色时,我想只显示红色投资组合。我怎么能这样做?
由于
答案 0 :(得分:1)
您可以向ng-model
添加Drop-down
属性,并在filter
的{{1}}中引用该属性
ng-repeat