Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ie8 Expected Identifier error - Angular

My app is running in almost all browsers but when I use ie8 Expected Identifier happened.

 $scope.delete = function (index) {

        $scope.recipelists.splice(index, 1);

        localStorage.setItem('markedRecipes', JSON.stringify($scope.recipelists))

        if ($scope.recipelists == 0) {
            $modalInstance.dismiss('cancel');
        }
} 

this is where ie8's console direct me when the error shows.

I don't know what's wrong with this.

Thanks!

like image 406
PipeMan Avatar asked Apr 23 '26 07:04

PipeMan


2 Answers

IE8 doesn't support reserved words as literal object properties. Use

$scope['delete']

instead.

like image 164
Felix Kling Avatar answered Apr 24 '26 20:04

Felix Kling


As per my understanding IE8 give storage to only valid domains. Try placing your example in some Web-server it should resolve the issue.

I faced the same issue when I tested it as an individual file but when i placed it in a server(Tomcat in my case) it just worked fine.

Source:-https://stackoverflow.com/a/12776794/1632286

like image 27
squiroid Avatar answered Apr 24 '26 21:04

squiroid