The code is available here: https://plnkr.co/edit/gbbsEnXxVpLsxvtKsDxw?p=preview. The filter filter: { a : 'x' }
works and only one row is shown.
Question:
- It seems
filter: { a : 'xxx' }
matches any text ina
as long as the text contains the stringxxx
. What if I want to do exact matching? - How to implement: show all the rows if
a = 'xxx' or b = 3
not not usec
? - Maybe it's better to use javascript code on `model.dashbardRows?
dashboard.component.js
(function () {
'use strict';
angular.module('testModule', [])
.component('dashboard', {
templateUrl: 'dashboard.component.html',
controllerAs: 'model',
controller: [controller]
});
function controller() {
var model = this;
model.dashboardRows = [
{a:'xxx', b:1, c:'ss'},
{a:'yyy', b:2, c:'tt'},
{a:'zzz', b:3, c:'uu'}];
}
})();
dashboard.component.html
<div>
Test
<table>
<tr ng-repeat="i in model.dashboardRows | filter: { a : 'x' }">
<td>{{i.a}}</td>
<td>{{i.b}}</td>
</tr>
</table>
</div>