1

So I am trying to get angular working on IE8. I have followed all the steps on http://docs.angularjs.org/guide/ie and it seems to be working -- I see the content of ng-view rendered on IE8 when I switch between views.

The problem is that I don't actually see any content in the inspector:

enter image description here

.. it's just an empty ng-view tag. I can see all of the content on the page, but no styling is applied to anything inside ng-view.

I am not sure whether this is an angular or HTML5 issue. I have added the html5shiv and HTML5 elements outside of ng-view are styled nicely.

EDIT

I have determined that the problem is HTML5 elements. <section> and <article> are not styled inside ng-view, while simple divs receive all the specified styling. Outside of ng-view, <nav> and <header> are styled just fine.

2
  • are you importing <link> or <style> tags in template? Commented Dec 13, 2013 at 2:26
  • @charlietfl All of my stylesheets are defined in the <head> of the page, including the ones that should apply to templates. Commented Dec 13, 2013 at 7:39

2 Answers 2

1

I was able to fix this by conditionally including jQuery in IE8 based on answer given here https://stackoverflow.com/a/18317832/2026098

Sign up to request clarification or add additional context in comments.

2 Comments

Include jQuery if IE8? I have the same problem but don't know hoe to fix it... Include it before or after Angular?
jQuery needs to be included in <head>. I have included angularjs just before closing the </body>.
1

The problem here is that, even if you add a namespace and/or precreate your elements according to the IE guide there are certain parts of the angular core that don't pass through the normal jQuery element creation - I have had the issue persist even when using full jQuery instead of Angular's jQLite but I've heard that fixes things for most people. Using an HTML5 shim doesn't solve the issue on its own either.

But even so, I would prefer to not have to substitute jQuery if possible, in which case you'll need to also do the following to get a fully working solution:

  • Add reset styles for the block-level HTML5 elements so they display: block; correctly
  • Target the HTML5 elements with a colon prefix as well in your CSS. You need to escape these, it will look like this: header, \3A header { /*...*/ }. Note that there is a space between the escape sequence and the rest of the selector.
  • If you are using jQuery, you will need to use a 1.10.x version or conditional tags to switch to it in IE8.

2 Comments

Having later tested on ie8 on Windows XP, I can confirm that adding \:section, \:article... { display: block} is what fixed the issue for me.
To clarify for those reading: using \3A header or \:header in a stylesheet is perfectly equivalent, I was preferring the hex code format since my preprocessor (in this case, LESS) had trouble parsing the colon-escaping syntax.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.