In spark when sending a view model to the view when a collection is empty is causing me some headaches like so:
<input value="model.addresses[0].street" />
Where "model.addresses" may be empty and thus gives an NRE.
Is there anyway to handle this other than populating the collections prior to rendering. This is a bit of a pain as it reqiures some custom processing to make sure they are populated. I was thinking the spark conditional attribute would work:
<input value="model.addresses[0] != null?model.addresses.street" />
But I feel like there may be a better way to handle these situations.