Angular与IE7文档模式7配合良好。它也适用于IE8文档模式8,但IE8文档模式7无法正常工作。 这是错误:
{
description: "Member not found.
",
message: "Member not found.
",
name: "Error",
number: -2147352573
}
这是抛出错误的行:
this.$$element.attr(attrName, value);
Member not found
我正在使用Angular 1.2.9。我该如何解决?
答案 0 :(得分:2)
我找到了解决方案。只需检查是否(msie&& msie< = 8),它也可以在IE7中运行。 我还更改了jqLiteRemoveClass和jqLiteAddClass
function jqLiteRemoveClass(element, cssClasses) {
if (msie && msie <= 8) {
if (cssClasses) {
forEach(cssClasses.split(' '), function(cssClass) {
element.className = trim(
(" " + element.className + " ")
.replace(/[\n\t]/g, " ")
.replace(" " + trim(cssClass) + " ", " ")
);
});
}
} else {
if (cssClasses && element.setAttribute) {
forEach(cssClasses.split(' '), function(cssClass) {
element.setAttribute('class', trim(
(" " + (element.getAttribute('class') || '') + " ")
.replace(/[\n\t]/g, " ")
.replace(" " + trim(cssClass) + " ", " "))
);
});
}
}
}
function jqLiteAddClass(element, cssClasses) {
if (msie && msie <= 8) {
if (cssClasses) {
forEach(cssClasses.split(' '), function(cssClass) {
if (!jqLiteHasClass(element, cssClass)) {
element.className = trim(element.className + ' ' + trim(cssClass));
}
});
}
} else {
if (cssClasses && element.setAttribute) {
var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')
.replace(/[\n\t]/g, " ");
forEach(cssClasses.split(' '), function(cssClass) {
cssClass = trim(cssClass);
if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {
existingClasses += cssClass + ' ';
}
});
element.setAttribute('class', trim(existingClasses));
}
}
}