Answer the question
In order to leave comments, you need to log in
How to make such pipe filter in angular 4?
Good afternoon!
There is a filter.pipe.ts class that filters an array by given attributes.
For example:
<input #searchField (keyup)="0" type="text" class="form-control" id="search-left-input" placeholder="Строка поиска">
<li *ngFor="let field of fields | filter: 'name' : searchField.value" class="list-group-item">
<label class="checkbox-inline">
<input type="checkbox" name="fields" value="{{field.id}}" [checked]="field.checked" (change)="field.checked = !field.checked; onCheckboxFieldClick(field)">
{{field.name}}
</label>
</li>
<ul *ngFor="let well of wells | filter: 'field.name' : 'number' : searchObject.value" class="list-group" id="search-bottom-list">
<li *ngFor="let testObject of well.testObjectOption | filter: 'name' : searchObject.value" class="list-group-item">
<label class="checkbox-inline">
<input type="checkbox" name="testObjects" value="{{testObject.id}}" [checked]="testObject.checked" (change)="testObject.checked = !testObject.checked">
{{ well.field.name }} / {{ well.number }} / {{ testObject.name }} ({{ testObject.begin }} — {{ testObject.end }})
</label>
</li>
</ul>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question