Ember.js {{each}} vs {{collection}}

后端 未结 3 695
孤城傲影
孤城傲影 2021-02-19 17:11

I understand each and collection helper methods are two possible ways to iterate over a list of items in my handlebars templates. I am looking for some

3条回答
  •  迷失自我
    2021-02-19 17:40

    As @Abdull stated in the comments to your question, the {{collection}} view helper has been deprecated and, as a result, {{each}} is the suggested usage.

    /**
      `{{collection}}` is a `Ember.Handlebars` helper for adding instances of
      `Ember.CollectionView` to a template. See `Ember.CollectionView` for
      additional information on how a `CollectionView` functions.
    
      ...
    
      @method collection
      @for Ember.Handlebars.helpers
      @param {String} path
      @param {Hash} options
      @return {String} HTML string
      @deprecated Use `{{each}}` helper instead.
    */
    

    Source code: ember.js/packages/ember-handlebars/lib/helpers/collection.js

提交回复
热议问题