Angular 8 using async pipe for Internet Explorer 11

后端 未结 1 1216
小鲜肉
小鲜肉 2021-01-23 19:05

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 c

1条回答
  •  走了就别回头了
    2021-01-23 19:40

    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:

    1. Create a new tsconfig tsconfig-es5.app.json next to tsconfig.app.json with the below contents:

      {
       "extends": "./tsconfig.app.json",
       "compilerOptions": {
           "target": "es5" 
        }
      }
      
    2. In angular.json add two new configuration section under the build and serve 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"
          }
        }
      },
      
    3. Run the serve with this configuration using the below command:

      ng serve --configuration es5
      

    0 讨论(0)
提交回复
热议问题