PipeMan
PipeMan

Reputation: 141

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!

Upvotes: 3

Views: 2050

Answers (2)

squiroid
squiroid

Reputation: 14027

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

Upvotes: 1

Felix Kling
Felix Kling

Reputation: 816364

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

$scope['delete']

instead.

Upvotes: 8

Related Questions