0

I've recently been asked to try and fix an app built in angularjs to work in IE7. The main issue seems to be retrieving data from the server.

The following example code works on all browsers > IE7

    $scope.getEntity = function (id, callback) {
        $http.get('/views/entities/' + id).
            success(function(data) {
                $scope.entity = data;
                callback();
            }).
            error(function(data) {
                $window.location.href = '/error';
            });
    };

When this fires in IE7 it always ends up throwing an error with an undefined data parameter and redirects to the error page.

Any ideas why this would be happening? It's only isolated to IE7 as it works fine in all other browsers.

5
  • 2
    Have you checked this? code.angularjs.org/1.2.28/docs/guide/ie Commented May 13, 2016 at 13:00
  • @estus Thanks I have been through that document. Angular seems to be working ok but when I call one of our service endpoints it fails for some reason. Only in IE7. Commented May 13, 2016 at 13:03
  • 1
    And you checked the section regarding JSON.stringify, didn't you? Nobody except you knows what your exact setup is. You may consider recreating the issue in plunker and sharing it, it is not something that can be solved blindly. Commented May 13, 2016 at 13:08
  • @estus Your absolutely right. I did add the polyfill script but I removed it as I didn't think it worked. Added it back in and it works now. Happy to mark this as the answer. Commented May 13, 2016 at 13:26
  • Glad it worked for you. Commented May 13, 2016 at 13:35

1 Answer 1

1

As 1.2.x manual says,

To make your Angular application work on IE please make sure that:

You polyfill JSON.stringify for IE7 and below. You can use JSON2 or JSON3 polyfills for this.

Polyfills may be missed in the places where JSON methods should be obviously called (like JSON AJAX requests).

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

Comments

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.