3

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!

PipeMan
  • 141
  • 1
  • 14

2 Answers2

8

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

$scope['delete']

instead.

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
  • If you have a decent syntax highlighter installed you can normally catch these errors. Somehow $scope.case when past me.. thanks for the tip! – sidonaldson Jul 08 '15 at 10:58
1

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

Community
  • 1
  • 1
squiroid
  • 13,809
  • 6
  • 47
  • 67