javascript - angular monitor DOM change outside angular's realm -


here the jsbin link,

i want use regular dom api manipulation , feed angular.

the result if using $timeout, works. not window.settimeout. know not right way deal angular. in 3rd party component case, makes sense allow 3rd party non angular developer use pure vanilla or jquery change angular generated dom attribute expected result.

how watch or observe attribute change , update angular scope?

i found hacky way make work adding line. $interval(function(){$(el).attr('info');},2000), comment out in jsbin see expected behavior.

but it's not quite want. better solutions?

basically, angular doesn't know there change if outside angular context, need tell angular has changed.

one of thing, using $timeout service. there cleaner solution this.

the place using jquery change dom, can call tell angular fix things:

angular.element(document.queryselector("body")).scope().$apply(); 

$apply() method call trigger digest cycle manually angular on it's own when work inside angular context.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -