Ember.js - 从计算属性返回unicode字符 [英] Ember.js - Return unicode character from computed property
问题描述
我正在尝试从一个计算属性返回一个unicode字符,但&
不断被转义为& amp; amp; code>。
我甚至试图返回一个Handlebars SafeString,如下所示:
return new Ember.Handlebars.SafeString();
...产生相同的结果:& amp;#61573 ;
我该如何让这个工作?
编辑: 这可能与我在 valueBinding
中使用 {{input}}
helper。 SafeString方法确实保持&
不被转义,如果我在其他地方使用该值。
我刚刚创建了一个简单的jsbin: http:// jsbin .com / izurix / 5 / edit
基本上这样做不会返回任何& amp c $ c>对我来说:
App.ApplicationController = Ember.ObjectController.extend({
value:
someValue:function(){
return new Handlebars.SafeString(this.get('value'));
} .property('value')
}) ;
此外,如果您不希望该句柄转义您的字符串,您应该使用三重斜杠 {{someValue}}}
。
希望有帮助。 $ b
I'm trying to return a unicode character from a computed property, but the &
keeps getting escaped as &
.
I've even tried returning a Handlebars SafeString like so:
return new Ember.Handlebars.SafeString("");
...which produces the same results: 
How can I get this working?
Edit: This is probably related to the fact that I'm using the computed property in the valueBinding
of an {{input}}
helper. The SafeString method does keep the &
from being escaped if I use the value elsewhere.
I just created a simple jsbin: http://jsbin.com/izurix/5/edit
Basically doing this does not return any &
for me:
App.ApplicationController = Ember.ObjectController.extend({
value: "",
someValue: function() {
return new Handlebars.SafeString(this.get('value'));
}.property('value')
});
Furthermore if you don't want that handlebars escapes your string you should use triple-slash {{{someValue}}}
.
Hope it helps.
这篇关于Ember.js - 从计算属性返回unicode字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!