handlebars - is it possible to access parent context in a partial?

后端 未结 8 1473
旧巷少年郎
旧巷少年郎 2020-12-04 15:40

I\'ve got a handlebar template that loads a partial for a sub-element.

I would need to access a variable from the parent context in the calling template, from within

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 15:58

    You can use some of the proposed solutions on the comments from the link to github:

    https://github.com/wycats/handlebars.js/issues/182#issuecomment-4206666
    https://github.com/wycats/handlebars.js/issues/182#issuecomment-4445747

    They create helpers to pass the info to the partial.

提交回复
热议问题