Why does angularjs cause multiple comments in between render data? Inspecting DOM childNodes causes extra nodes which takes up memory. Is there a way to remove them?
Angular needs these comments to operate with some directives. Removing those comments breaks Angular and it is not allowed to do so currently.
It is also explained in this Github issue.
Angular uses the comments do figure out where the last element was placed in relation. It's here in the source code https://github.com/angular/angular.js/commit/9efa46ae640cde17487c341daa9a75c0bd79da02
The comments are written client-side so there's no impact on transfer, and if your application is that memory conservative, Angular is probably the wrong language to use in the first place.
I find these comments annoying too. You can turn off the content of them though. Just set debugInfoEnabled
to false
in the config:
$compileProvider.debugInfoEnabled(false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With