0
私たちは、のようないくつかの特殊文字のキー名を渡す方法オブジェクトキー(特殊文字またはスペース付き)をlodashテンプレートに渡す方法は?
var compiled = _.template('<%= [hello] %>')({ 'hello': 'how are you'});
console.log(compiled);// how are you
やオブジェクトなどの
var compiled = _.template('<%= hello %>')({ 'hello': 'how are you' });
console.log(compiled);//how are you
キーのように、テンプレート内のキーのように配列を渡すことができますか?
var compiled = _.template("<%= ['hell:-o'] %>")({ 'hell:-o': 'how are you' });
などの多次元配列と、
var compiled = _.template("<%= [hello][hello] %>")({ 'hello': {'hello': 'how are you'} });
正常に動作します。 @Dogbertありがとう – intekhab