I have two types of mongo documents that contain an array of strings:
first document:
{
...
spotify: { user: 'bob',
playlist: 'running'
}
...
}
second document:
{
...
spotify: { user: 'bob',
track: 'The Black Keys - Fever'
}
...
}
in my template I want to display different html depending on the field present in the document
something like:
{{#if spotify.playlist}}
<div class="playlist">{{spotify.playlist}}</div>
{{/if}}
{{#if spotify.track}}
<div class="track">{{spotify.track}}</div>
{{/if}}
in practice there is a lot more html, so just using a helper that returns the class accordingly does not work/would be messy.
Does the approach Iām taking make any sense?
Or do have to work with helpers that check if the fields exist and then return true/false?