I AngularJS v1.2.0。我只在IE11上收到以下错误。
TypeError:无法获取属性' insertBefore'匿名函数的未定义或空引用(/Scripts/angular.js:3850:11)atEach(/Scripts/angular.js:303:9)at enter(/Scripts/angular.js:3849:9)at Anonymous函数(/Scripts/angular.js:18725:17)at publicLinkFn(/Scripts/angular.js:5420:29)at ngRepeatAction(/Scripts/angular.js:18723:15)at $ watchCollectionAction(/ Scripts / angular。 js:11299:11)在Scope.prototype。$ digest(/Scripts/angular.js:11395:21)在Scope.prototype。$ apply(/Scripts/angular.js:11634:13)at done(/ Scripts / angular.js:7635:34)
它适用于Firefox。执行以下自定义指令时失败。
.directive('appMyCourseCards', ['$compile', '$log', function ($compile, $log) {
return {
restrict: 'E',
replace: true,
scope: {
},
link: function (scope, element, attributes, controller) {
var content = '<div class="well well-sm bottomSmallMargin" ng-repeat="schedule in studentSubjectSchedules | filterCourses:\'' + attributes.termperiodparingids + '\' ">' +
'<div class="row">' +
'<div class="col-md-12">' +
'<div class="pull-left">{{schedule.SSECName}}</div>' +
'</div>' +
'</div>' +
'</div>';
element.append($compile(content)(scope.$parent));
}
};
任何帮助都将受到高度赞赏。
感谢。
答案 0 :(得分:0)
您是否可以添加自定义过滤器的详细信息&#39; filterCourses&#39;?
我用大部分代码创建了这个Plunk,它在IE11中运行正常,所以我怀疑它可能是导致问题的过滤器。 这就是我在Plunker中所拥有的。
.directive('appMyCourseCards', ['$compile', '$log', function ($compile, $log) {
return {
restrict: 'E',
replace: true,
scope: {
},
link: function (scope, element, attributes, controller) {
scope.$parent.studentSubjectSchedules = [{SSECName: "name1"}, {SSECName: "name2"}];
var content = '<div class="well well-sm bottomSmallMargin" ng-repeat="schedule in studentSubjectSchedules " >' +
'<div class="row">' +
'<div class="col-md-12">' +
'<div class="pull-left">{{schedule.SSECName}}</div>' +
'</div>' +
'</div>' +
'</div>';
element.append($compile(content)(scope.$parent));
}
}}]);