Feature
Add a directive that loops over a received value.
The value can be: Array and Object.
Considering the model
{
basket: ['milk', 'eggs', 'banana'],
user: {
name: 'John Doe',
age: 100,
address: 'Earth'
}
}
The directive should work with the following sintaxes:
Array loop
Markup
<div k-for="item in basket">
<p k-text="item"></p>
<div>
Rendered
<p k-text="item">milk</p>
<p k-text="item">eggs</p>
<p k-text="item">bananas</p>
Object loop
Markup
<div k-for="info in user">
<p k-text="info"></p>
<div>
Rendered
<p k-text="info">John Doe</p>
<p k-text="info">107</p>
<p k-text="info">Earth</p>
Implementation observations
- See how this can be achieved, apparently, it can be done with the
template tag.
- The directive should not manipulate the elements directly but change the scope of where the data should be bound.
- The directive should run before all others, because the scopes should be changed before they execute.
Feature
Add a directive that loops over a received value.
The value can be: Array and Object.
Considering the model
The directive should work with the following sintaxes:
Array loop
Markup
Rendered
Object loop
Markup
Rendered
Implementation observations
templatetag.