0

I am trying to implement lazy loading with angularAMD

Plunker please click to reproduce in IE browser

Here is my code. Please help me...

require.config({
  baseUrl: "js/scripts",

  // alias libraries paths.  Must set 'angular'
  paths: {
    'angular': '//ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min',
    'angular-route': '//ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-route.min',
    'angularAMD': '//raw.github.com/marcoslin/bower-angularAMD/v0.1.0/angularAMD.min',
    'ngload': '//raw.github.com/marcoslin/bower-angularAMD/v0.1.0/ngload.min',
    'restangular': '//cdn.jsdelivr.net/restangular/latest/restangular.min',
    'underscore': '//cdn.jsdelivr.net/underscorejs/1.5.2/underscore-min'
  },

  // Add angular modules that does not support AMD out of the box, put it in a shim
  shim: {
    'angularAMD': ['angular'],
    'angular-route': ['angular'],
    'restangular': ['angular', 'underscore']
  },

  // kick start application
  deps: ['app']
});
Paolo Moretti
  • 54,162
  • 23
  • 101
  • 92
  • 1
    Can you post the exception type and the line of code that is causing the problem? – Paolo Moretti Apr 14 '14 at 14:30
  • The body of your question should contain the text of the exception and the code which is relevant to the question. It is fine to provide links to provide additional context but these links cannot **replace** what should be in the question. – Louis Apr 14 '14 at 16:04

1 Answers1

0

The problem is caused by IE refusing to load JS unless mime type is set correctly. If you check your IE Developer Tool console, you will see error:

SEC7112: Script from https://raw.github.com/marcoslin/bower-angularAMD/v0.1.0/angularAMD.min.js was blocked due to mime type mismatch

The sample code used is loading JS from raw.github.com which return the file as text/html instead of text/javascript. The solution is simply to recreate the files locally. See:

http://plnkr.co/edit/lmLLiOSGRVxmzSWV0Oh4?p=preview

marcoseu
  • 3,892
  • 2
  • 16
  • 35