Frage

I have a template, and I pass in an object. Some of its string properties are null.

When this is the case, the template prints out

$myObj.MyProp

as soon as the property has an actual string value, the string value will be replaced in the template correctly.

I'd prefer not to have to wrap it with an if statement.

Any ideas?

War es hilfreich?

Lösung

Try the quiet reference notation:

$!myObj.MyProp
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top