Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

AngularJS is throwing "TypeError: Cannot read property 'childNodes' of undefined" when using DOM elements that trigger directives in ng-view #5069

Closed

Description

Dear angular guys,

after upgrading AngularJS from version 1.0.8 to 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:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html ng-app="test">
<head>
  <title></title>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js"></script>
  <script type="text/javascript" src="http://code.angularjs.org/1.2.1/angular-route.js"></script>
  <script type="text/javascript">
    angular.module('test', ['ngRoute'])
               .config(['$routeProvider', function($routeProvider) {
                    $routeProvider.when('/', {
                        template: 'Hello world!'
                    });
               }]);
  </script>
</head>
<body>
  <div ng-view>
    <div>
        <a href="#"></a>
    </div>
  </div>
</body>
</html>
  • Open the file in any browser and watch the console

As soon as the <a>-Tag is removed, the exception disappears. This issue might be related to #2532.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions