【问题标题】:Handlebars partial in Sammy.jsSammy.js 中的部分车把
【发布时间】:2012-08-16 23:38:28
【问题描述】:

我一直在搜索 sammy.js 和车把的文档很长一段时间,但我无法终生确定 http://sammyjs.org/docs/api/0.7.1/all#Sammy.Handlebars(示例 #2)mypartial.hb 中的哪个位置被指示加载到{{>你好朋友}}。想法?

【问题讨论】:

  • 该部分在 .hb 文件中的位置/如何生成?
  • 是的,当然。如何在 Sammy 中实现这一点

标签: javascript html templates handlebars.js sammy.js


【解决方案1】:

我这个问题很老,但对于所有 sammyjs 爱好者

var app = $.sammy('#app', function(){

    this.use('Mustache', 'ms');

    this.get('#/hello/:name/to/:friend', function(context){
        this.load('mypartial.ms')
        .then(function(partial){
            context.partials = {hello_friend: partial};
            context.name = context.params.name;
            context.friend = context.params.friend;

            context.partial('mytemplate.ms');
        });
    });
});

http://sammyjs.org/docs/api/0.7.4/all#Sammy.Handlebars 注意版本是0.7.4

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-01
    • 1970-01-01
    • 2013-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-30
    • 1970-01-01
    相关资源
    最近更新 更多