简体   繁体   中英

handlebars.js path context in helper method

I have a handlebar helper function registered as follows:

Handlebars.registerHelper('link', function(text, url){
   return text + url; //whatever, return something
});

Now, if I call it like so, it works.

{{{link "hello" "localhost" }}} //works

but If I pass in a variable that has a path in it, it fails

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

Is this a bug with Handlebars?

在beta4中对我有用: http : //jsfiddle.net/mgcross/GMrnz/34/您引用的'url'键是否嵌套?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM