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!
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!
Share Improve this question asked Jan 21, 2015 at 5:52 PipeManPipeMan 1411 silver badge14 bronze badges 7- Do IE8 supports local storage? – qamar Commented Jan 21, 2015 at 5:54
- This might answer stackoverflow./questions/3452816/… – PipeMan Commented Jan 21, 2015 at 5:58
- @qamar: Either way, that would throw a reference error, not a syntax error. – Felix Kling Commented Jan 21, 2015 at 5:59
- Check if any of these is a possibility, stackoverflow./questions/2149762/… – Janaki Sathiyamurthy Commented Jan 21, 2015 at 6:00
- 1 delete is a keyword in javascript so it may cause problem also as pankaj said .splice can also cause problem. not sure will need to check. – chandings Commented Jan 21, 2015 at 6:12
2 Answers
Reset to default 8IE8 doesn't support reserved words as literal object properties. Use
$scope['delete']
instead.
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./a/12776794/1632286
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744751631a4591633.html
评论列表(0条)