I've been working on a project using Angular. The code snippet in my HTML file looks like this:
<div>{{ data.date | date:'d-MMM-y' || '-' }}</div>
<div>{{ data.id || '-' }}</div>
The issue I'm encountering is that when the value from the API for fields like date or id is null, the next div element shifts upwards. What I want is for the div to remain in its original position even if the value is null. To achieve this, I added || '-'
to all the fields in my code, but it doesn't seem to be working as intended. The dash "-" should appear in the HTML when the API value is null, but it's not showing up. Can anyone guide me on how to fix this?