Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/391.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript helper方法中的handlebar.js路径上下文_Javascript_Handlebars.js - Fatal编程技术网

Javascript helper方法中的handlebar.js路径上下文

Javascript helper方法中的handlebar.js路径上下文,javascript,handlebars.js,Javascript,Handlebars.js,我有一个把手助手功能,注册如下: Handlebars.registerHelper('link', function(text, url){ return text + url; //whatever, return something }); 现在,如果我这样称呼它,它是有效的 {{{link "hello" "localhost" }}} //works 但如果我传入一个有路径的变量,它就会失败 {{{link "hello" ../url}}} //the second arg

我有一个把手助手功能,注册如下:

Handlebars.registerHelper('link', function(text, url){
   return text + url; //whatever, return something
});
现在,如果我这样称呼它,它是有效的

{{{link "hello" "localhost" }}} //works
但如果我传入一个有路径的变量,它就会失败

{{{link "hello" ../url}}} //the second argument becomes undefined

这是把手上的错误吗?

在beta4中对我有效:您引用的“url”键是嵌套的吗?

可能是
{{{{link“hello”“../url”}}
?谢谢,原来我不需要它,但很高兴知道它能工作。