AngularJS: parse HTML events on timeline

While debugging my angularjs app, I found a lot of parsing events in dev tools. enter image description here

The timing shows that this event is being fired jQuery.extend.buildFragment

and I am having a hard time figuring out which directive is causing the html parsing.

How can I determine what exactly is causing the parsing of the html events? Probably the reason could be ng-repeat

, but I'm not sure.

These events slow down $scope.$apply

.

+2


source to share


1 answer


Every partial html in angular will fire an XML parse event like ng-includes, ng-repeat, directives and $ digest.

Also using jQuery will give you a lot of overhead for initializing jquery instances. jQuery or jQlite buildFragment is called when you or directives or angular call element.html ("something tags"), which in turn write to innerHTML, which trigger HTML parsing events in the browser and angular, these kids walk around. to find more directives and compile until complete.



To minimize them you need to do a batch process, but the angular nature would be difficult to do directly. Maybe you can try to use the one-off :: in angular 1.3+ binding syntax or make fewer observers so angular won't have to parse the html over and over again.

0


source







All Articles