javascript - How to set the src attribute of a ngInclude element in the call back of a ajax request? -
the example @ nginclude shows how update src attribute of nginclude element.
in similar way, trying assign template path variable in callback of ajax request. after assignment, doing $rootscope.$apply($scope.setmaintemplatepath).
injecting $rootscope function containing callback.
but getting following error:
error: 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations: [["fn: function (){var a=d.url();if(!n||a!=f.absurl())n++,c.$evalasync(function(){c.$broadcast(\"$locationchangestart\",f.absurl(),a).defaultprevented?f.$$parse(a):(d.url(f.absurl(),f.$$replace),f.$$replace=!1,h(a))});return n}; newval: 30; oldval: 29"],["fn: function (){var a=d.url();if(!n||a!=f.absurl())n++,c.$evalasync(function(){c.$broadcast(\"$locationchangestart\",f.absurl(),a).defaultprevented?f.$$parse(a):(d.url(f.absurl(),f.$$replace),f.$$replace=!1,h(a))});return n}; newval: 31; oldval: 30"],["fn: function (){var a=d.url();if(!n||a!=f.absurl())n++,c.$evalasync(function(){c.$broadcast(\"$locationchangestart\",f.absurl(),a).defaultprevented?f.$$parse(a):(d.url(f.absurl(),f.$$replace),f.$$replace=!1,h(a))});return n}; newval: 32; oldval: 31"],["fn: function (){var a=d.url();if(!n||a!=f.absurl())n++,c.$evalasync(function(){c.$broadcast(\"$locationchangestart\",f.absurl(),a).defaultprevented?f.$$parse(a):(d.url(f.absurl(),f.$$replace),f.$$replace=!1,h(a))});return n}; newval: 33; oldval: 32"],["fn: function (){var a=d.url();if(!n||a!=f.absurl())n++,c.$evalasync(function(){c.$broadcast(\"$locationchangestart\",f.absurl(),a).defaultprevented?f.$$parse(a):(d.url(f.absurl(),f.$$replace),f.$$replace=!1,h(a))});return n}; newval: 34; oldval: 33"]] @ error (unknown source) @ object.$digest (http://localhost:3000/assets/angular-1.0.1.min.js?body=1:85:413) @ object.$apply (http://localhost:3000/assets/angular-1.0.1.min.js?body=1:87:58) @ htmldivelement.<anonymous> (http://localhost:3000/assets/web/angularjs/controllers.js?body=1:40:27) @ htmldivelement.<anonymous> (http://localhost:3000/assets/jquery.js?body=1:3257:9) @ htmldivelement.<anonymous> (http://localhost:3000/assets/jquery.js?body=1:2876:28) @ object.trigger (http://localhost:3000/assets/jquery.js?body=1:3145:12) @ htmldivelement.<anonymous> (http://localhost:3000/assets/jquery.js?body=1:3782:17) @ function.each (http://localhost:3000/assets/jquery.js?body=1:659:20) @ [object object].each (http://localhost:3000/assets/jquery.js?body=1:272:17) please point out if have missed or doing wrong. thanks.
you shouldn't calling scope.$apply unless dealing outside of angular's control. more code help.
Comments
Post a Comment