Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue when selection and onSelectionChanged are bound to same scope variable #10

Open
anupamN opened this issue Aug 24, 2015 · 3 comments

Comments

@anupamN
Copy link

anupamN commented Aug 24, 2015

I am facing an issue when i bind selection and onSelectionChanged to same scope variable. For Example,

        <hierarchical-selector id="product"
                               class="tree-browser"
                               ng-model="searchModel.products"
                               data="productHierarchy"
                               on-selection-changed="searchModel.products = items"
                               multi-select="true"
                               selection="searchModel.products"
                               no-button/>

I am using selection to display default selected values when page loads for the first time. When user manually changes the selected nodes on the tree, itemSelected is called which calls onSelectionChanged. The watch on selection is triggered as both are bound to same variable. This in turn calls itemSelected and so on. The code goes into an infinite loop and the web page freezes. Is there a solution to the problem?

@BaurzhanSakhariev
Copy link

Yep, I'm also waiting for fix for that issue=)

@BaurzhanSakhariev
Copy link

@lukemurray, could you please give me an idea to fix it by myself? What scripts and functions should be investigated?

@lukemurray
Copy link
Owner

Hmm that is weird.I'd look at the hierarchical-selector directive, and see what it is doing with the attributes. I think it wants onSelectionChange to be a function...

What happens if you change onSelectionChanged to a function on the scope and in the function assigned the value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants