Vereonix
Vereonix

Reputation: 1424

AngularJS 'SCRIPT1002: Syntax error' IE9+ when trying .filter

This issue is only when loading the page in IE, its fine in Chrome/FF/Edge.

I have the following...

 $scope.getOtherInfo = function (appID) {       
        $scope.otherInfo = $scope.applications.filter(e => e.ApplicationId === appID).map(function (el) {
            return ({
                AppID: appID,
                Title: el['Title'].replace(/ /g, '')               
            });
        });
    };

(applications is a multi dimensional array, and otherInfo is null at this point)

This works fine in Chrome etc, can be called does its job etc. In IE though on page load I get

SCRIPT1002: Syntax error jsFile.js (98,58)

Which points to the below row

  $scope.otherInfo = $scope.applications.filter(e => e.ApplicationId === appID).map(function (el) {

I'm not sure how to even break the line down even more to try and debug exactly what it doesn't like.

Upvotes: 0

Views: 311

Answers (1)

nircraft
nircraft

Reputation: 8478

Ie9 doesn't support Arrow functions. Please check this link for supported browsers:

try using normal function methods to perform your operations. if that doesn't work, check if your page is rendered in Quirks mode, IE9 supports map, but most possibly your html page is rendered in quirks mode, that's it's failing. Try to add doctype to your page and check if it works.

Upvotes: 1

Related Questions