Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
var data = $scope.programDetails.dataSource._pristineData.filter(x => x["ID"] == id)[0];


What I have tried:

var data = $scope.programDetails.dataSource.data().filter(function (x) { x.ID == id})[0];
Posted
Updated 27-Sep-19 9:56am
Comments
Richard MacCutchan 27-Sep-19 13:00pm    
Is there supposed to be a question there?
Chinnu2020 27-Sep-19 13:03pm    
Is there any syntax issue?

Arrow functions[^] are not supported in any version of Internet Explorer.

If you need to support Internet Explorer, then you cannot use arrow functions; you must use regular functions.
JavaScript
var data = $scope.programDetails.dataSource.data().filter(function (x) { return x.ID == id; })[0];

But remember that even Microsoft will tell you that Internet Explorer is not a web browser!
The perils of using Internet Explorer as your default browser - Microsoft Tech Community - 331732[^]
 
Share this answer
 
Apart from the obvious solution that Richard provided in his answer, Solution 1, I recommend that you use other modern tools and libraries that take away this pain of "works in Chrome, and not in IE", such as Polyfill.

Polyfill.io[^]
Supported Browsers on Polyfill.io[^]

Hardcoding these conditions in your own scripts will only cause troubles in a long run, since you would need to take care of other browsers/platforms/devices, too. Tools like Polyfill are capable of taking this pain away from you. :-)

Oh, and focus on writing ES6 compliant code, as that is less error-prone compared to the older versions of JavaScript.
JavaScript ES6 — write less, do more[^]
ECMAScript 2015 support in Mozilla - JavaScript | MDN[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900