foreach binding
duplicates section of markup for each entry in an array. Binds each copy of that markup to array item. You can nest foreach binding with other control-flow bindings such as if and with.You can use special context property $data, to refer the current array item itself.
You can also use $index to refer the index of current array element. $index is an observable. Similarly you can use $parent to refer to data outside foreach.
Use as option to create alias for the array elements.
In scenarios like in middle of a list, you can't use foreach binding as above, in such a case you can use containerless control flow syntax which is based on comment tags.
Note : Destroyed entries are hidden by default. but you can set includeDestroyed option in foreach loop to make them visible.
0 comments:
Post a Comment