Access elements filtered by pipe in angular html template

1 · Adrian Matei · Nov. 25, 2022, 10:35 a.m.
To access the filtered results of the pipe just define it as a variable via the as keyword. In the following example the bookmarkFilter filters the list of bookmarks based on some text search, and I need to check the filtered results contain only one element [showMoreText] = "filteredBookmarks.length === 1 "(to display the fool content of the bookmark) <div class="mt-3" *ngFor="let bookmark of bookmarks | bookmarkFilter: filterText as filteredBookmarks"> <app-bookmark-list-element [showMor...