【发布时间】:2015-06-28 15:52:02
【问题描述】:
我有以下模板:
{{if . eq "login failed"}}
<span class="text-error">Incorrect username or password</span>
{{else if . eq "login success"}}
<span class="text-success">You have successfully logged in!</span>
{{end}}
我在执行模板时传递了一个字符串。
但是,我收到以下错误:
executing "login.html" at <.>: can't give argument to non-function .
如何比较模板中的字符串?
【问题讨论】:
标签: go-templates