Skip to content

$key not available in @each directive #13

@W0lfw00d

Description

@W0lfw00d

Describe the bug
When using the @each directive the $key/index isn't available.
The documentation states:
'The key for the current iteration will be available as the key variable within your view partial.' But when you try to use $key in your template it's undefined.

To Reproduce
In your main template:
@each('partial.car', $cars, 'car')
and inside `partial/car.slice.php':
{{$key}}
Expected behavior
print the key/index

Versions (please complete the following information):

  • PHP: 7.2
  • CodeIgniter: 3.1.9
  • Slice: 1.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions