나는 몇 가지 javascript 'fixes'로 IE8에서 완벽하게 작동하는 AngularJS를 사용하여 2 개의 프로덕션 응용 프로그램을 만들었습니다.
먼저 개발자 콘솔이 열려 있지 않으면 console.log 문이 실패합니다.
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function() {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = (window.console = window.console || {});
while (length--) {
method = methods[length];
// Only stub undefined methods.
if (!console[method]) {
console[method] = noop;
}
}
}());
둘째, 내가 날짜 시간 스탬프를 변환 toISOString을 사용하여 다음 JS는 각 응용 프로그램을 생성합니다 초기 페이지에 스 니펫 나는 그것을 해결했습니다. IE에서, 그 기능은 내가이 조각 사용하고 있으므로 구현되지 않은 :
/*IE8 toISOString hack */
if (!Date.prototype.toISOString) {
Date.prototype.toISOString = function() {
function pad(n) { return n < 10 ? '0' + n : n }
return this.getUTCFullYear() + '-'
+ pad(this.getUTCMonth() + 1) + '-'
+ pad(this.getUTCDate()) + 'T'
+ pad(this.getUTCHours()) + ':'
+ pad(this.getUTCMinutes()) + ':'
+ pad(this.getUTCSeconds()) + '.'
+ pad(this.getUTCMilliseconds()) + 'Z';
};
}
셋째, foreach는 방법은 IE에서 지원되지 않습니다, 그래서이 사용하고 이러한 모든 코드를
/*IE8 hack to support forEach */
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(fn, scope) {
for(var i = 0, len = this.length; i < len; ++i) {
fn.call(scope, this[i], i, this);
}
}
}
을 스 니펫은 StackOverflow 답변과 YMMV에 대한 작업에서 가져온 것입니다.
각도 IE8 설명서를 읽었으므로 설명서에 설명 된 상황이 발생하지 않았습니다. 지시문의 경우 다음 형식을 사용합니다. <div directive-name>
및 모든 것이 올바르게 작동합니다.
어떻게 작동하는지는 아닙니다. 오히려 무엇을 시도했는지 보여 주시고 작동하지 않는 부분을 알려 주시면 고칠 수 있도록 도와 드리겠습니다. –