문제

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?

도움이 되었습니까?

해결책

Try the quiet reference notation:

$!myObj.MyProp
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top