1

I'm passing an object to an AngularJS directive like so:

<context-selector
            is-buy="true"
            num-to-select="0"
            init-object="{ads: rule.ads_list, adContainer: rule.container_ad_id, campaign: rule.campaign_id}">
        </context-selector>

and it causes Angular infinite digest loop because of the init-object.
I guess that's because Angular compares the object by reference. The directive definition is:

directive('contextSelector', function() {
        return {
            restrict: 'E',
            scope: {
                vertical: "@",
                levelsDepth: "@",
                isBuy: "@",
                shellsLeft: "=",
                numToSelect: "@",
                initObject: "=" // {ads: [1,2], adContainer: 4, campaign: 6}
            },

Is there a solution to this issue?

1 Answer 1

3

After I did some more searching on google, I came up with this post: https://github.com/angular/angular.js/issues/4054

Apparently it's a known issue and was fixed in Angular >= 1.2.5

Sign up to request clarification or add additional context in comments.

1 Comment

Yes. I was able to reproduce with this basic example plnkr.co/edit/3wKmWz?p=preview

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.