在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML5/ angular4中對ie9和ie10的兼容性問題

angular4中對ie9和ie10的兼容性問題

如題,在ie11下沒有任何問題,但在ie9和ie10下,會直接報script1002:語法錯誤圖片描述
無從下手,也不知道該怎么處理,求大觸們指導(dǎo)

v2

報錯還是這個報錯,但是偶然發(fā)現(xiàn)只有在ng serve時才會出現(xiàn)這個bug,ng build后的文件上傳至服務(wù)器后可以正常打開,不會報錯,但是比較奇怪的是,所有的(click)和*ngIf等用angular4的語法寫出來的代碼,就像失效了一樣,包括一些表單的hasError方法,都會失效。

一臉懵逼求大觸指導(dǎo)

回答
編輯回答
假灑脫

4開啟之后沒有問題了。今天升級折騰了一下?lián)Q成5又出現(xiàn)1002語法錯誤。而且是一樣的問題,簡直無敵了。polyfills.ts配置和4一樣沒有改動

2018年8月1日 02:20
編輯回答
蝶戀花

Run npm install --save intl.
Run npm install --save classlist.js.
然后找到src里面的polyfills.ts文件,將注釋打開

/**
 * 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 >= 10, Chrome >= 55 (including Opera),
 * Edge >= 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/weak-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`.

/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';


/**
 * Required to support Web Animations `@angular/animation`.
 * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-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';

PS:在IE9中,日期管道顯示有問題(yyyy-mm-dd HH:mm:ss這種格式),需要自己寫一個日期的管道

2017年6月27日 10:49
編輯回答
風(fēng)畔

但是感覺IE9還是不兼容誒,打開polyfills.ts里面的注釋以后,IE11可以運(yùn)行了。但是IE9還是會報錯。。。

2017年3月11日 20:42
編輯回答
替身

如果你是用的angular/cli生成的項目,在/src目錄下會有一個polyfills.ts的文件,里面是官方推薦的對一些瀏覽器的兼容性補(bǔ)丁,如果需要兼容ie,可以去掉一下多行的注釋,如圖:
圖片描述

2017年12月31日 09:15
編輯回答
挽青絲

樓主,問題解決了么?

2017年7月29日 10:04