Trying to retrieve a filtered list of data in my component. In the view, I have something similar to this:
<ng-container *ngIf="(items | filter:search.value) as result">
<div *ngFor="let item of result">
{{item}}
</div>
</ng-container>
Now, I need to access the result
from the component.
One way is to add {{result_setter(result)}}
to the ng-container and create a method with a variable in the component:
filtered_data;
result_setter(data) {
this.filtered_data = data;
}
However, this approach doesn't look very clean. Can someone provide assistance? I came across this article , where users in the comments are facing a similar issue.