title: Angular 4 IE9 file upload Script438:Object doesn't support property or method 'apply'
body: <p>I use Angular 4 and file upload not work in IE9,please help me.</p>
  
  <p>IE 9 error:TypeError: Object doesn't support property or method 'apply'</p>
  
  <p><a href="https://i.stack.imgur.com/pf2qg.jpg" rel="nofollow noreferrer">IE 9 Error image</a></p>
  
  <p><strong>Version:</strong></p>
  
  <pre><code>{
        "name": "fido",
        "version": "0.0.0",
        "license": "MIT",
        "scripts": {
          "ng": "ng",
          "start": "webpack-dev-server --port=4200",
          "build": "webpack",
          "test": "karma start ./karma.conf.js",
          "lint": "ng lint",
          "e2e": "protractor ./protractor.conf.js",
          "prepree2e": "npm start",
          "pree2e": "webdriver-manager update --standalone false --gecko false --quiet"
        },
        "private": true,
        "dependencies": {
          "@angular/animations": "^4.1.3",
          "@angular/common": "^4.0.0",
          "@angular/compiler": "^4.0.0",
          "@angular/core": "^4.0.0",
          "@angular/forms": "^4.0.0",
          "@angular/http": "^4.0.0",
          "@angular/platform-browser": "^4.0.0",
          "@angular/platform-browser-dynamic": "^4.0.0",
          "@angular/router": "^4.0.0",
          "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.26",
          "bootstrap": "^4.0.0-alpha.2",
          "classlist.js": "^1.1.20150312",
          "core-js": "^2.4.1",
          "intl": "^1.2.5",
          "ng2-file-upload": "^1.2.1",
          "rxjs": "^5.1.0",
          "web-animations-js": "^2.2.5",
          "zone.js": "0.8.5"
        },
        "devDependencies": {
          "@angular/cli": "1.0.3",
          "@angular/compiler-cli": "^4.0.0",
          "@types/jasmine": "2.5.38",
          "@types/node": "~6.0.60",
          "codelyzer": "~2.0.0",
          "jasmine-core": "~2.5.2",
          "jasmine-spec-reporter": "~3.2.0",
          "karma": "~1.4.1",
          "karma-chrome-launcher": "~2.1.1",
          "karma-cli": "~1.0.1",
          "karma-jasmine": "~1.1.0",
          "karma-jasmine-html-reporter": "^0.2.2",
          "karma-coverage-istanbul-reporter": "^0.2.0",
          "protractor": "~5.1.0",
          "ts-node": "~2.0.0",
          "tslint": "~4.5.0",
          "typescript": "~2.2.0",
          "webpack-dev-server": "~2.4.2",
          "webpack": "~2.2.0",
          "autoprefixer": "^6.5.3",
          "css-loader": "^0.28.1",
          "cssnano": "^3.10.0",
          "exports-loader": "^0.6.3",
          "file-loader": "^0.10.0",
          "json-loader": "^0.5.4",
          "karma-sourcemap-loader": "^0.3.7",
          "less-loader": "^4.0.2",
          "postcss-loader": "^1.3.3",
          "postcss-url": "^5.1.2",
          "raw-loader": "^0.5.1",
          "sass-loader": "^6.0.3",
          "script-loader": "^0.7.0",
          "source-map-loader": "^0.1.5",
          "istanbul-instrumenter-loader": "^2.0.0",
          "style-loader": "^0.13.1",
          "stylus-loader": "^3.0.1",
          "url-loader": "^0.5.7"
        }
      }
  </code></pre>
  
  <p><strong>index.html</strong>
      //I also include some js from "<a href="https://angular.io/guide/browser-support" rel="nofollow noreferrer">https://angular.io/guide/browser-support</a>"</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;title&gt;&lt;/title&gt;
    &lt;base href="/"&gt;
  
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;link rel="icon" type="image/x-icon" href="favicon.ico"&gt;
    &lt;link rel="stylesheet" href="assets/css/bootstrap.min.css"&gt;
    &lt;link rel="stylesheet" href="assets/css/font-awesome.min.css"&gt;
    &lt;link rel="stylesheet" href="assets/css/reset.css"&gt;
    &lt;link rel="stylesheet" href="assets/css/index.css"&gt;
  
    &lt;script src="assets/js/shim.min.js"&gt;&lt;/script&gt;
    &lt;script src="assets/js/classList.min.js"&gt;&lt;/script&gt;
    &lt;script src="assets/js/Blob.js"&gt;&lt;/script&gt;
    &lt;script src="assets/js/formdata.js"&gt;&lt;/script&gt;
    &lt;script src="assets/js/Intl.min.js"&gt;&lt;/script&gt;
    &lt;script src="assets/js/typedarray.js"&gt;&lt;/script&gt;
    &lt;script src="assets/js/core.min.js"&gt;&lt;/script&gt;
    &lt;script src="assets/js/es6-shim.min.js"&gt;&lt;/script&gt;
    &lt;script src="assets/js/shims_for_IE.js"&gt;&lt;/script&gt;
    &lt;script src="assets/js/system-polyfills.js"&gt;&lt;/script&gt;
    &lt;script src="assets/js/jquery-1.11.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;app-root&gt;Loading...&lt;/app-root&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>polyfills.ts</strong></p>
  
  <pre><code>/**
   * This file includes polyfills needed by Angular and is loaded before the app.
   * You can add your own extra polyfills to this file.
   *
   * This file is divided into 2 sections:
   *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
   *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
   *      file.
   *
   * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
   * automatically update themselves. This includes Safari &gt;= 10, Chrome &gt;= 55 (including Opera),
   * Edge &gt;= 13 on the desktop, and iOS 10 and Chrome on mobile.
   *
   * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
   */
  
  /***************************************************************************************************
   * BROWSER POLYFILLS
   */
  
  /** IE9, IE10 and IE11 requires all of the following polyfills. **/
   import 'core-js/es6/symbol';
   import 'core-js/es6/object';
   import 'core-js/es6/function';
   import 'core-js/es6/parse-int';
   import 'core-js/es6/parse-float';
   import 'core-js/es6/number';
   import 'core-js/es6/math';
   import 'core-js/es6/string';
   import 'core-js/es6/date';
   import 'core-js/es6/array';
   import 'core-js/es6/regexp';
   import 'core-js/es6/map';
   import 'core-js/es6/set';
  
  /** IE10 and IE11 requires the following for NgClass support on SVG elements */
   import 'classlist.js';  // Run `npm install --save classlist.js`.
  
  /** IE10 and IE11 requires the following to support `@angular/animation`. */
   import 'web-animations-js';  // Run `npm install --save web-animations-js`.
  
  
  /** Evergreen browsers require these. **/
  import 'core-js/es6/reflect';
  import 'core-js/es7/reflect';
  
  
  /** ALL Firefox browsers require the following to support `@angular/animation`. **/
   import 'web-animations-js';  // Run `npm install --save web-animations-js`.
  
  
  
  /***************************************************************************************************
   * Zone JS is required by Angular itself.
   */
  import 'zone.js/dist/zone';  // Included with Angular CLI.
  
  
  
  /***************************************************************************************************
   * APPLICATION IMPORTS
   */
  
  /**
   * Date, currency, decimal and percent pipes.
   * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
   */
   import 'intl';  // Run `npm install --save intl`.
  /**
   * Need to import at least one locale-data with intl.
   */
   import 'intl/locale-data/jsonp/en';
  </code></pre>
  
  <p><strong>upload-cert.component.ts</strong></p>
  
  <pre><code>  constructor(public fb: FormBuilder, public _passwordAndUploadCert: UploadCertService) { }
  
    uploadCert(){
      if(this.formErrors.certFormError == '' &amp;&amp; this.certFile){
        this._passwordAndUploadCert.uploadCert(this.certFile)
            .subscribe(
              data =&gt; console.log(data+'-----'),
              error =&gt; console.log(error+'error!!!')
            )
      }
    }
  
    selectedFileOnChanged(event:any) {
      this.formErrors.certFormError = '';
      this.certName = event.target.value;
      this.certFile = event.target.files[0];
  
      if(this.certFile.size &gt; 1024*1024*8){
        this.formErrors.certFormError = '文件大小上传大于8Mb。'
      }
      else if(this.certFile.type != "application/x-x509-ca-cert" &amp;&amp; this.certFile.type != "application/x-pkcs12"){
        this.formErrors.certFormError = '必须上传.cer或.pfx后缀的证书';
      }
    }
  </code></pre>
  
  <p><strong>upload-cert.component.html</strong></p>
  
  <pre><code>&lt;button type="submit" class="btn btn-primary" (click)="uploadCert()"&gt;上传&lt;/button&gt;
  &lt;input type="file" (change)="selectedFileOnChanged($event)" id="upload_input"/&gt;
  </code></pre>
  
  <p><strong>upload-cert.service.ts</strong></p>
  
  <pre><code>  public uploadCert(file:File){
      let formData:FormData = new FormData();
      formData.append('uploadFile' , file , file.name);
      let headers= new Headers();
      headers.append('Content-Type', 'multipart/form-data');
      headers.append('Accept', 'application/json');
      let options = new RequestOptions({ headers: headers });
      return this.http
        .post(this.certUrl , formData , options)
        .map((res: Response) =&gt; {
            console.log(res);
        })
    }
  </code></pre>