AngularJS – Permitting AngularJS templates in IE8

So, you’ve got something like this:

But you find that in IE8 the directive that populates the <mytemplate/> element is not working at all in IE8. IE8 will not initialise the controller and hence your $scope is null.

In IE8 if you view source, you’ll see the non XHTML tag to be somewhat garbled



The solution is to programmatically create the element in IE8


The above snippet is only invoked by IE8 and below.  It will permit this element in the markup, hence the JS error goes away, the angular directive succeeds.