Support Search GitHub This repository Watch https://github.com/angular/angular.js/issues/5069 4,394 Star 52,544 Fork 25,902 angular/angular.js Code Issues 684 Pull requests 179 Projects 0 Wiki Pulse Graphs New issue AngularJS is throwing "TypeError: Cannot read property 'childNodes' of undefined" when using DOM elements that trigger directives in ng-view #5069 Closed manuel-josupeit-walter-aleri opened this Issue cannot read Nov 21, 2013 · 12 comments Projects None yet Labels component: $compile frequency: moderate needs: investigation severity: regression type: bug Milestone 1.2.2 - conscious... Assignees tbosch 7 participants manuel-josupeit-walter-aleri commented Nov 21, 2013 Dear angular guys, after upgrading AngularJS from version 1.0.8 to cannot read property 1.2.1 we've encountered an exception being thrown in compositeLinkFn on line 5539: TypeError: Cannot read property 'childNodes' of undefined at compositeLinkFn (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js:5539:36) at compositeLinkFn (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js:5539:13) at publicLinkFn (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js:5444:30) at boundTranscludeFn (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js:5555:21) at controllersBoundTransclude (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js:6145:18) at update (http://code.angularjs.org/1.2.1/angular-route.js:838:13) at Scope.$broadcast (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js:11851:28) at http://code.angularjs.org/1.2.1/angular-route.js:549:26 at wrappedCallback (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js:10597:81) at wrappedCallback (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js:10597:81) This error seems to occur only when the routing module is in use and tags are nested within the ng-view container. At least one of these tags must also match any angularjs directive (such as a-tags or form-tags). Reproducable: always Browsers: Chrome 31, Firefox 25 and IE 10 Operating system: Windows 8.1 Steps to reproduce: Create a new html file Add the following content to the newly created file:
Childnodes Error
Contents |
Cannot Read Property "childNodes" Of Undefined In AngularJS By Ben Nadel on August 20, 2015 Tags: Javascript / DHTML The other day at InVision, we launched some code that worked fine locally, fine in QA, fine cannot read property 'childnodes' of undefined angularjs in Staging, and fine in Production - except for a small set of users.
Cannot Read Property 'childnodes' Of Undefined At Compositelinkfn
For just a few people, the page was completely breaking with the AngularJS-initiated JavaScript error, "TypeError: Cannot Read Property 'childNodes' Of Undefined." cannot read property 'childnodes' of null javascript After the customer support team dug into the tickets, they noticed a trend that most of the users were in Europe; and, that most of the users had the "CookiesOK" Google Chrome plugin installed. It turns
Cannot Read Property 'childnodes' Of Undefined Ionic
out, this was just one of a number of Google Chrome plugins that can [potentially] disrupt the AngularJS compile and linking lifecycle.I've tried to follow the AngularJS compile and linking code to figure out exactly what is going wrong. But, to be honest, the code is a bit too complicated for me to trace effectively. I understand, at a high level, what is going wrong; but, I cannot determine the low-level landscape cannot read property 'childnodes' of undefined javascript of details. Ultimately, the error has to do with the fact that the DOM (Document Object Model) is being altered indirectly, by a Controller, during the compile and linking phase. The alteration of the DOM throws the internal tree-walker out of whack and we end up referencing an undefined node.In our particular case, the problem relates to a breakdown in the separation of concerns between module types. In AngularJS, the Controller is not supposed to know anything about the DOM. And, to that extend, it probably shouldn't load any services that mutate the DOM. But, that's exactly what we were doing - we were loading a service that was injecting a 3rd-party Script element as part of its initialization.The Controller was [indirectly] mutating the DOM, which is a big no-no in AngularJS.On its own, this may not have been a problem - or rather, the problem may never have become symptomatic. But, for users that had certain Google Chrome plugins installed, the page would break because the plugins themselves were injecting Script tags into the HTML element of the page. The 3rd-party script tags would then getting injected before the plugin-injected tags, and that's what was breaking everything.To get a sense of what I'm talking about, here is an isolated use-case:
here for a quick overview of
Cannot Read Property 'childnodes' Of Undefined Ui Router
the site Help Center Detailed answers to any questions
Cannot Read Property 'childnodes' Of Null Lightning
you might have Meta Discuss the workings and policies of this site About typeerror cannot read property of undefined angular Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions http://www.bennadel.com/blog/2892-typeerror-cannot-read-property-childnodes-of-undefined-in-angularjs.htm Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up TypeError: Cannot read property 'childNodes' of http://stackoverflow.com/questions/27560826/typeerror-cannot-read-property-childnodes-of-undefined-angular undefined angular up vote 6 down vote favorite I am stuck with this error, am having a custom directive for creating a bar chart, which gets generated from a json file. Here is my code, I have a Index.Html page, where one view is routed inside based on the navigation here is the Index.Html