Git Product home page Git Product logo

angularjs-ie8-shim's Introduction

AngularJS 1.4+ IE8 shim

Prereqs

  • jQuery (1.*) must be included for IE8 (you can put this within IE Conditional tags if you want)
  • ES5 Shim must be included

General

  • Tested as of the latest AngularJS version # 1.4.5
  • Magic

How it works :: Installation

To start off, you'll need to add the following code at the bottom of your <head> tag. This code includes the es5 shim, as well as some scripts & styles needed to get IE8 working like usual.

<!--[if IE 8]>
    <!-- you can use a CDN or host it locally -->
    <script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/4.0.5/es5-shim.min.js"></script>
    <script>
        document.createElement('ng-view');
        document.createElement('ng-form');
        <!-- ng-form is needed if you are using WebForms -->
    </script>
    <style>
        .ng-hide { display: none !important; }
        [ng-cloak] { display:none !important; }
    </style>
<![endif]-->
Now, in the end of your body tag where the rest of your JavaScript is, add the Angular IE8 shim:

<script src="Angular-JS-ie8-shim.min.js" />

<!-- Make sure you include jQuery 1.* somewhere here as well for iE8 -->
THEN, you can add all your angularJS files, etc.
<script src="angular.1.4.7.min.js" />
<!-- etc etc -->
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Tips (since we care about IE8)

The usual IE8 gotchas apply, as well as some angular-specific ones.

  • Be careful of IE8 keywords such as finally / catch / continue / etc

    • For example, promises / $q with the object method promise.finally() will break.

    • Any custom object methods such as myObject.continue() will break as well.

    • If you need to use these, simply use Array notation: promise['finally'](function () { }); myObject['continue']();

  • Use ATTRIBUTE (restrict: 'A') directives <div my-directive /> (unless you want to manually add each individual document.createElement tags. (I recommend only making extremely global ones 'E' element directives.

  • Make sure to test all directives specifically in IE8, sometimes directive inception breaks down in IE8.

angularjs-ie8-shim's People

Contributors

irperez avatar markpieszak avatar

Watchers

 avatar  avatar

Forkers

rwson jsonzoup

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.