Skip to content
This repository was archived by the owner on Mar 31, 2022. It is now read-only.
This repository was archived by the owner on Mar 31, 2022. It is now read-only.

Add method to render loop in template #4

@EmilienLeroy

Description

@EmilienLeroy

Feature

Actually you need to do this :

`
  <h1>This element has items</h1>
  ${this._items.map((item, i) => `
    <div>
      I am item number ${i < 10 ? '0' + (i + 1) : i + 1}. 
      My name is ${item.name}.
    </div>
  `.trim()).join('')}
`

The new version should be something like this :

`
  <h1>This element has items</h1>
   ${
       renderLoop(this._items, (item, i) => {
           return `
              <div>
                    I am item number ${i < 10 ? '0' + (i + 1) : i + 1}. 
                    My name is ${item.name}.
              </div>`
       }
    }
`

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions