Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道一个字符串是否为空我正在尝试做
{{if closedOn != "" }}
但它没有给我正确的输出
{{if closedOn}}
应该可以工作 - 假设 closedOn 可以是日期或您想要排除的值,例如 undefined/null/""。
您可以像这样进行检查:
if (closedOn) { // closedOn is defined and it length > 0 }
您的检查方式不正确,原因
(undefined != "") is true (null != "") is true