angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Using custom tag names in directive template doesn't work in IE8

Open redaemn opened this issue 13 years ago • 1 comments

The following example works perfectly in Chrome but it will not work in IE8; to make it work one should:

  • substitute the <child> node with the equivalent attribute version <span child>, or
  • use the template directive option instead of templateUrl

Is this a feature or a bug?

Thanks for your AWESOME job guys!!!

(I didn't create a jsfiddle because it doesn't seem to support IE8 anymore...)

<!DOCTYPE html>
<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.js"></script>
        <script src="test.js"></script>
    </head>
    <body>

        <div ng-app="customModule">
            Hello <span parent></span>!!
        </div>

    </body>
</html>

here's the content of test.js file:

document.createElement('parent');
document.createElement('child');

angular.module("template/parent.html", []).run(["$templateCache", function($templateCache) {
  $templateCache.put("template/parent.html",
    "<span> - <child ng-repeat='child in children' name='child.name'></child> - </span>"
    );
}]);

angular.module("template/child.html", []).run(["$templateCache", function($templateCache) {
  $templateCache.put("template/child.html",
    "<span>{{name}} </span>"
    );
}]);

angular.module('customModule', ["template/parent.html", "template/child.html"])

.directive("parent", function() {
    return {
        restrict: 'EA',
        replace: true,
        scope: {},
        //template: "<span> - <child ng-repeat='child in children' name='child.name'></child> - </span>",
        templateUrl: "template/parent.html",
        link: function($scope) {
          $scope.children = [
            {
              name: 'child1'
            },
            {
              name: 'child2'
            }
          ];
        }
    };
})

.directive("child", function() {
    return {
        restrict: 'EA',
        replace: true,
        scope: {
          name: '='
        },
        //template: "<span>{{name}} </span>"
        templateUrl: "template/child.html"
    };
});

redaemn avatar May 22 '13 21:05 redaemn

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

btford avatar Aug 24 '13 00:08 btford