I am trying to accomplish a conditional binding using a dom-if
inside a dom-repeat
. Here is my code:
<template is="dom-repeat" items="{{customers}}">`
<template is="dom-if" if="_continueLoop(index)" indexAs="index">
Data renders here
</template>
</template>
Function _continueLoop(index)
looks like:
_continueLoop: function (value) {
alert("This function is not being called at all!No alert message.");
if (value == 1) return true;
else return false;
}
My intention is to stop dom-repeat
loop to continue if value of index
is 1
, i.e. when first 2 records are fetched I want the loop to stop fetching more.
What is the best way to do this?