Angular 1.4.8 与 IE11 不兼容 - 对象不支持 属性 或方法 'endsWith'
Angular 1.4.8 incompatible with IE11 - Object doesn't support property or method 'endsWith'
如何使用 HAndsOnTable 和 Angular 1.4.8 使 JSFiddle 与 IE11 一起工作?我收到此错误:
Object doesn't support property or method 'endsWith'
我不确定,但我认为罪魁祸首是这一行:
$scope.$apply();
我修复了你的 fiddle,我还修复了 IE11 错误。请注意 .endWith()
在 IE 中不是一个有效的函数。将此函数添加为原型后就可以了:
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(searchString, position) {
var subjectString = this.toString();
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
var lastIndex = subjectString.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
}
(取自https://www.sitepoint.com/community/t/endswith-issue-in-ie11/233838)
如何使用 HAndsOnTable 和 Angular 1.4.8 使 JSFiddle 与 IE11 一起工作?我收到此错误:
Object doesn't support property or method 'endsWith'
我不确定,但我认为罪魁祸首是这一行:
$scope.$apply();
我修复了你的 fiddle,我还修复了 IE11 错误。请注意 .endWith()
在 IE 中不是一个有效的函数。将此函数添加为原型后就可以了:
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(searchString, position) {
var subjectString = this.toString();
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
var lastIndex = subjectString.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
}
(取自https://www.sitepoint.com/community/t/endswith-issue-in-ie11/233838)