IE11 Angular 2 error "Expected identifier, string or number"
The main problem is IE has Compatibility Mode enabled by default. And IE 11 has some compatibility mode issues. As per the followings question answer Angular 2 / 4 not working in IE11
When I tried to disable the compatibility mode off It works fine.
But ingeneral user will not off the compatibility mode. So I want a good solution for that.
Then I found following solution form Force IE compatibility mode off using tags
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Related videos on Youtube
David Maisuradze
Senior Full Stack Developer I am Senior Full Stack Developer with 6+ years of experience creating websites, web services and mobile applications. I am interested in mastering new technologies, frameworks and design patterns. I am always open to new opportunities and would welcome the chance to speak with you. What I can bring to you is my ability to work hard, solve programmatic problems and work in a teams or on my own with enthusiasm to seek new challenges in the eld of programming.
Updated on June 04, 2022Comments
-
David Maisuradze almost 2 years
Well, I have created site using Angular 2. When I run "ng-serve" command and trying to test my site using "http://localhost:4200" in Google Chrome and IE11 it works perfectly, but, if I build project using "ng-build --prod", host it on IIS. Site still works on Chrome, but IE11 shows the following errors:
I googled it and found that it was maybe reserved words in my identifiers key:value pairs. So I added Apostrophes(') arround my keys. For example I had the following object:
user:UserViewModel={ Username:"", Age:0 }; and changed this to: user:UserViewModel={ 'Username':"", 'Age':0 };
Also deleted last commas in key:value pairs and imported core.js in polyfills.ts
-
Partha Sarathi Ghosh over 6 yearsExactly same problem for me. No solve found any where.
-
Günter Zöchbauer over 6 yearsWhat's the code at the positions mentioned in the error output?
-
Emin Laletovic over 6 yearsThis might help -> stackoverflow.com/questions/12675622/… or stackoverflow.com/questions/15632568/…
-
Wagner Danda da Silva Filho over 6 yearscan you show us your polyfills.ts file?
-
Wagner Danda da Silva Filho over 6 yearsalso, what version of the cli are you using?
-
-
secondbreakfast almost 5 yearsbless your soul