I have a list of items with ngIf like the following
Each item can appear several times but only the records from this year will appear. This works.
When clicking an item inside this list, I want to reload this page but this time, the list should only show records of the selected item (regardless the date).
I understand that I should change
isItemInThisYear to accommodate either options but how can I send the value/parameter from the clicked item to the whole page so it will reload itself with the relevant parameter?
Don’t do this. Set a property inside each
item and check that inside the
ngIf instead. Function calls inside template expressions that are evaluated during change detection are a performance disaster.
I’m sorry but I’m not sure I understood your answer.
I need that an item click will “reload” the page but this time with a parameter that defines the condition whether to show the item or not. How can I do it by clicking an item? what action should I do in order for the list to reload itself?
Simply change a bound property and let Angular’s change detection do the rest. Docs here.
What do you mean by that?
Any kind of help will be appreciated
What’s the point of reloading a page ? You just have to use filter on your array easy peasy… As rapropos told you, using a function in a ngIf is a very bad idea.
Thank you very much, it works