Skip to content Skip to sidebar Skip to footer

Adding Custom Element To NgRepeat List

I am developing a mobile app using the cordova + onsenui + angularJs and there are special requirements for populating the ngRepeat list. Some items could have additional paramet

Solution 1:

You can achieve the desired results by adding an ng-if statement to HTML elements that you only want to appear in the DOM when the item in ng-repeat has certain characteristics. For example:

<ons-list-item modifier="tappable" ng-repeat="item in items">
    <label class="checkbox checkbox--list-item">
        <input type="checkbox" ng-model="item.selected">
    </label>
    <button ng-if="item.name=='Potato'">This button will only appear for item3</button>
</ons-list-item>

In the above example, the button will only appear in the DOM if the item.name is Potato.


Post a Comment for "Adding Custom Element To NgRepeat List"