0

I have an HTML block that is accessing values using ng-repeat in an object array 'items' of type:

[{
    method: 0,
    text: 'text1'
},
{
    method: 1,
    text: 'text2'
},
{
    method: 3,
    text: 'text3'
}]

Below is the HTML block:

<div class="item" ng-if="$ctrl.isHighlighted()">
    <div class="item-label">Highlighted field</div>
    <span ng-repeat="item in $ctrl.items track by $index">
        <span>{{item.text}}</span>
    </span>
</div>

The isHighlighted() method in component populates the 'items' array and returns length of the array, so the block will only be rendered if length > 0.

But I keep getting the error: Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! How can I stop ng-repeat from going into an infinte loop?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.