when I create a publication, select a category. Later in a different page, I show all the categories, but I need to show only the categories that contain publications.
in ruby on rails would be something like that
- if category.posts
#show
json of categories data
[{"Cortes":{"name":"Cortes"}, "peinados":{"name":"peinados"}}]
json of posts data
[{"category": "Cortes","title": "first"}]
in this case only the category Cortes contains a publication, I need the other does not show because there are no publications with that category. in this way I show the categories:
<ul>
<li *ngFor="let category of categories">
{{ category.name }}
</li>
</ul>