简体   繁体   中英

Using result of one helper function in another helper function within Handlebars

I am checking if there is anyway that I can use the result of one helper function in another helper function and how can I use it, for example, I am looping through as below

{{#each v.NOVNumber as |vv iindex|}}

And then if I am getting another element as below, using the same index:

{{get v.NOVNoticeTypeName iindex}}

Can I use this element that we have got in a statement like below, to check if that is first or last element etc?

{{#if (isFirst v.NOVNumber vv)}}

You you can use helpers together to create more powerful functions. Ember Composable Helpers provides both a good pattern for using helpers together as well as the specific has-next and has-previous helpers that you need to know if an element is first of last.

An example using has-next

{{#if (has-next page pages)}}
  <button>Next</button>
{{/if}}

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