javascript - Is there a way to forcibly reload a recursive ng-include in AngularJS? -


i'm using recursive script in angular app output representation of bunch of objects.

problem is, if change structure of object dynamically, view doesn't update. seems ng-include doesn't regenerate.

is there way force ng-include in view work again scratch?

i had same problem. try ui-if directive, solved problem.

app.directive("uiif", function () {                 return {                     transclude: 'element',                     priority: 1000,                     terminal: true,                     restrict: 'a',                     compile: function (element, attr, linker) {                         return function (scope, iterstartelement, attr) {                             iterstartelement[0].donotmove = true;                             var expression = attr.uiif;                             var lastelement;                             var lastscope;                             scope.$watch(expression, function (newvalue) {                                 if (lastelement) {                                     lastelement.remove();                                     lastelement = null;                                 }                                 if (lastscope) {                                     lastscope.$destroy();                                     lastscope = null;                                 }                                 if (newvalue) {                                     lastscope = scope.$new();                                     linker(lastscope, function (clone) {                                         lastelement = clone;                                         iterstartelement.after(clone);                                     });                                 }                                 iterstartelement.parent().trigger("$childrenchanged");                             });                         };                     }                 };             }); 

when value set false element disappear. on true render again.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -