Skip to content

Documentation for special values of key in each template helper  #16719

@saleswhale-vincent

Description

@saleswhale-vincent

Hello! I'm not sure if this is the right place for this but I wasn't sure where to ask. In the current documentation for the each template helper it talks about specifying keys but makes no mention of the special values for key, namely:

@index - The index of the item in the array.
@item - The item in the array itself. This can only be used for arrays of strings or numbers.
@Guid - Generate a unique identifier for each object (uses Ember.guidFor).

Which I discovered in this comment

Are these special values actually still valid in 3.2? And if they are, is it alright if I write them back into the documentation?

Activity

Serabe

Serabe commented on Jun 8, 2018

@Serabe
Member

After looking for it in source code, it seems that only @index and @identity are used, though not sure they are public values.

@rwjblue can you confirm please?

rwjblue

rwjblue commented on Jun 8, 2018

@rwjblue
Member

Correct. The following should be considered public API’s for the specific helpers.

{{each:

  • @index
  • @identity

{{each-in:

  • @key
  • @index
  • @identity

Tweaks to the API docs for these helpers to add mention of the available special values seems good.

rwjblue

rwjblue commented on Jun 8, 2018

@rwjblue
Member

Also, thought I should cross link this RFC: emberjs/rfcs#321

Serabe

Serabe commented on Jun 8, 2018

@Serabe
Member

Thanks, applying labels accordingly.

pixelhandler

pixelhandler commented on Sep 28, 2018

@pixelhandler
Contributor

@emberjs/learning-team-managers perhaps we can update the API docs accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rwjblue@pixelhandler@locks@Serabe@saleswhale-vincent

        Issue actions

          Documentation for special values of key in each template helper · Issue #16719 · emberjs/ember.js