angularjs recursive ng-include not refreshing when onload variable changes -


given example at:

http://jsfiddle.net/8lhjh/

the easiest way can explain interaction steps...

problem case:

  1. select item 1, see item1.items in box 2
  2. select item 2, see item1.items in box 2 still! (should item2.items in box 2)

functional case:

  1. select item 1, see item1.items in box 2
  2. select --root--, removes box 2
  3. select item 2, see item2.items in box 2

i think problem somewhere ng-include recursion...

<div ng-if="level < path.length && path[level] && citem.items[path[level]] && citem.items[path[level]].items" ng-include="'item_select_recur.html'" onload="citem=citem.items[path[level]];level=level+1;"></div> 

solved it!

http://jsfiddle.net/8lhjh/1/

the magic in manually updating box 2's scope (see jsfiddle complete example):

nextelement.scope().citem = parentitem.items[$scope.path[level]]; 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -