0
这是我的代码如何在使用空格键时检查匹配字符串?
<select id="updOrg">
{{#each organization}}
<option id="{{_id}}" {{ifSelected ../user.profile.organization}}>{{name}} </option>
{{/each}}
</select>
在我的模板帮助我的代码是
'ifSelected':function(org){
console.log(org);
console.log(this.name);
var name=this.name;
if(org === this.name){
console.log("matched");
return "selected";
}
}
在控制台中我得到
TEST
XXX
TEST
TEST
第二两个字符串匹配,但在这里它是不匹配的,如果条件
我也不能请参阅我的控制台中的matched
。
这里有什么问题
感谢您的回复,但首先回复'true'或'false'需要通过条件,条件仍然不起作用。我确定两个“测试”是相同的bcz我从数据库 – user1934044 2014-10-10 09:33:51
@ user1934044获得这些值,如果使用'console.log(JSON.stringify(org))'和'console.log(JSON .stringify(this.name))'而不是? – 2014-10-10 09:56:00
是的,这表明在一个字符串后面的空间,thnakyou非常帮助 – user1934044 2014-10-10 10:08:27