问题
I am using *ngIf
with async
pipe to show and hide HTML elements. It works on Google Chrome or Firefox. But it doesn't work on Internet Explorer, how can I make it work on IE?
Here is the source code: https://stackblitz.com/edit/angular-nbxpyp
回答1:
It seems that the project you provide can work well in IE 11. It shows "Successfull Message" in all browsers. Is there any error in console when it doesn't work in IE? Have you followed the steps of supporting Angular 8 in IE 11?
You need to follow the following steps to make Angular 8 app run in IE 11:
Create a new tsconfig
tsconfig-es5.app.json
next totsconfig.app.json
with the below contents:{ "extends": "./tsconfig.app.json", "compilerOptions": { "target": "es5" } }
In
angular.json
add two new configuration section under thebuild
andserve
target to provide a new tsconfig:"build": { "builder": "@angular-devkit/build-angular:browser", "options": { ... }, "configurations": { "production": { ... }, "es5": { "tsConfig": "./tsconfig-es5.app.json" } } }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { ... }, "configurations": { "production": { ... }, "es5": { "browserTarget": "yourAppName:build:es5" } } },
Run the serve with this configuration using the below command:
ng serve --configuration es5
来源:https://stackoverflow.com/questions/58380976/angular-8-using-async-pipe-for-internet-explorer-11