0

This works in Opera, Firefox, chrome, and safari but when I open up my Angular App in IE 11, I get an error:

SCRIPT1003: Expected ':'

controllers.js (386,17)

At line 386, this is the code:

  $http({
            method: 'POST',
            url: 'server/insertTicket.php',
            headers: {
                'Content-Type': undefined
            },
            data, // <--- line 386
            transformRequest: function (data, headersGetter) {
                var formData = new FormData();
                angular.forEach(data, function (value, key) {
                    formData.append(key, value);
                });

                var headers = headersGetter();
                delete headers['Content-Type'];

                return formData;
            }
        })
        .success(function (data) {
          ...... more code here ..... }

Where is it expected a colon?

1 Answer 1

2
data, // <--- line 386

must be:

data: data, // <--- line 386

because it's a field of an object. I'm not sure why Firefox/Chrome eat this, but IE is very picky (and correct) here.

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

4 Comments

Should note that the former short-hand approach is part of ES2015, and works as expected in Microsoft Edge.
@KentaGoto if it fixed your problem - can you accept the answer please? :)
Give me 7 minutes @DmitriyKhudorozhkov!
@KentaGoto no rush )

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.