Population
Comments of a post of a user
@frrri/ngxs-crud/populate exposes a populate() instruction.
Imagine the following scenario:
Now if you want to display the user's name for every post in your list, you can use populate()
to instruct the frrri resolver to fetch every post's user.
You can also fetch all comments for a post and then every user for every comment.
The populate() route instruction
Getting every post's user
When opening /posts-with-user
, it will load all posts and then all users of the loaded posts. If you are using PaginatedCrudCollection, it will do so for every page you load.
Getting one post's comments (via PopulationStrategy.ForeignId)
The same configuration would also work if you would change getActive() to getMany(). This would, however, populate all comments of every post loaded by getMany().
Last updated