NgHierarchicalSelector
NgHierarchicalSelector copied to clipboard
issue when selection and onSelectionChanged are bound to same scope variable
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?
Yep, I'm also waiting for fix for that issue=)
@lukemurray, could you please give me an idea to fix it by myself? What scripts and functions should be investigated?
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?