이것은 매우 기본 적이라고 확신하지만 ../model inside {{#if_eq}}
을 사용할 수 없습니다. 나는 ../../model을 사용해 보았고 model._revs_info의 자식을 가리킨다.처리기를 전달한 후 핸들 바 컨텍스트가 손실 됨
{{#each model._revs_info}}
{{debug ../model}}
{{#if_eq status compare="available"}}
{{debug ../model}}
<a href="#list/{{model.id}}/{{rev}}">{{rev}}</a>
{{/if_eq}}
{{/each}}
{{#if_eq}}
가 https://github.com/danharper/Handlebars-Helpers/blob/master/helpers.js
/**
* If Equals
* if_eq this compare=that
*/
Handlebars.registerHelper('if_eq', function(context, options) {
if (context == options.hash.compare)
return options.fn(this);
return options.inverse(this);
});
{{debug}}
에서 복사 한 내용은 Handlebars documentation on paths 따르면 http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");
console.log(this);
if (optionalValue) {
console.log("Value");
console.log("====================");
console.log(optionalValue);
}
});