contexte de chemin handlebars.js en helper
-
27-10-2019 - |
Question
J'ai une fonction d'aide du guidon enregistré comme suit:
Handlebars.registerHelper('link', function(text, url){
return text + url; //whatever, return something
});
Maintenant, si je l'appelle comme cela, cela fonctionne.
{{{link "hello" "localhost" }}} //works
mais si je passe dans une variable qui a un chemin, il échoue
{{{link "hello" ../url}}} //the second argument becomes undefined
Est-ce un bug avec Guidons?
La solution
il travaille pour moi dans beta4: http://jsfiddle.net/mgcross/GMrnz/34/ est la clé « url » que vous référencez imbriqué?
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow