为什么ng-bind-html进入无限循环
Why ng-bind-html goes into infinite loop ?
HTML:
<div tooltip="page 1 of 6, 2 of 11, 6 of 19" tooltip-placement="right" ng-bind-html="getField('page_01','Subject','txt_sub_propAdd')"></div>
角:
$scope.currentField='';//Use to hendle Angular Deigest Loop
$scope.getField = function(page, section, field) {
console.log(i++,section,field);
$scope.currentField=$sce.trustAsHtml(self.data.HTMLData[page][section][field]);
return $scope.currentField;
};
控制台输出:
0 "Subject" "txt_sub_propAdd"
1 "Subject" "txt_sub_propAdd"
2 "Subject" "txt_sub_propAdd"
3 "Subject" "txt_sub_city"
4 "Subject" "txt_sub_city"
5 "Subject" "txt_sub_city"
6 "Subject" "txt_sub_state"
7 "Subject" "txt_sub_state"
-----
-----
-----
-----
till infinity
屏幕上的输出:
<div tooltip="page 1 of 6, 2 of 11, 6 of 19" tooltip-placement="right" ng-bind-html="getField('page_01','Subject','txt_sub_propAdd')" class="ng-binding"><input type="text" label="Property Address" name="txt_sub_propAdd" value=" " maxlength="60" minlength="30" required="" id=" " class="form-control" regex="[^A-Za-z0-9_-/]" ng-model="subject.txt_sub_propAdd"></div>
PS:我必须在屏幕上显示600多个字段(文本框,单选按钮,复选框(。还要告诉我如何在控制器中获得 ng 模型值。
好的,我将结果保存在数组中而不是调用函数中。此外,我还使用此指令使我的字段可用于角度。
.directive('compile',function($compile, $timeout){
return{
restrict:'A',
link: function(scope,elem,attrs){
$timeout(function(){
$compile(elem.contents())(scope);
});
}
};
});
相关文章:
- 显示&作为&在jsp中使用angularjs而不使用ng-bind-html
- 使用滚动溢出-x进行无限循环
- 从index.html调用函数,该函数无限循环
- 使用jQuery无限循环播放HTML页面幻灯片
- Grunt任务没有加载,获得无限循环
- 如何在不进入无限循环的情况下将网站重定向到Facebook画布URL
- Backbone+RequireJS+Mediator模式导致视图逻辑短路和无限循环
- jQuery无限循环,动画化许多项目
- Angular 1.4解析ng-bind-html的内容
- 如何避免试图用php+jquery显示php起始页的无限循环
- 6502仿真增强型基本无限循环$C000至$E0ED
- Angular ngRoute导致无限循环和堆栈溢出
- angularjs ng if中的无限循环
- ng-禁用函数调用在 ng-repeat 下处于无限循环中
- Angular 中的无限循环使用 ng-bind
- 我的ng视图与index.html页面angularjs无限循环
- AngularJS具有ng视图的无限循环
- 为什么ng-bind-html进入无限循环
- 通过$scope访问函数中的ng-resource会导致无限循环
- 为什么用ng-value代替value会导致无限循环