How can I get to display the two category names on a ionic card. Currently doing
{{post.post_categories[0].name}} returns only the first name. How to do I get the second one to show as well?
Below is part of my wordpres rest api json response.
If a post doesn’t have four categories it throws an error if I dont use the ? operator. Im using an Observable and async so maybe that’s why its causing the issue.
I tought that too ?. is elvis operator. Today I learned, in kotlin ?. is called safe call operator and ?: is elvis operator. kotlin has no ternary operator. This things are so annoying, so much annoying.
That’s coming from the async pipe. None of the code inside the ion-card should be an issue as it’ll only render after the async pipe resolves the observable. One potential issue is the “post.id” inside the click function.
Try moving the ngFor portion to an ng-container instead of being directly in the ion-card. That will ensure nothing tries to access a post that doesn’t exist.
I dont know if im doing anything wrong but I got the same error as before. However the method I said I used is working. Thank you all for your help. I was wondering how do I cache the post page and post-detail pages in this thread: How do you cache http request using this method