Angular JS在IE11和FireFox中的绑定非常好,没有错误。但是在Chrome中,仍然没有错误,绑定在UI控件中失败,但在平面文本转储中,它渲染得很好。
铬 的火狐 的 IE11 的 Safari浏览器 虽然我没有图像,但绑定也适用于Safari。
我怀疑这必须是一个脚本冲突,但我似乎无法找到它。 这是我正在加载的脚本,按加载顺序。
此控件的我的数据结构是:
task.details {
buttonLabel:false,
correctiveActionSection:true,
correctiveActionTitle:"Corr Title",
correctiveLabel:"Corr Lbl",
deficiencyLabel:"Def Lbl",
inspect:true,
inspectionFailedLabel:"Insp Fail",
inspectionPassedLabel:"Insp Pass",
inspectionTitle:"Ins Title",
inspectionUntestedLabel:"Inspect Untest",
instance:[],
notCleanedLabel:"Cleaned",
noWorkLabel:"No Work",
recleanedLabel:"Recleaned",
role:{},
showCorrectiveText:true,
showDeficiencyText:true,
sop:{},
suppression:{},
items:[
{name:"a"},
{name:"aa"},
{name:"aaa", causeException:true},
{name:"aaaa", causeException:true},
{name:"aaaaa", causeException:true}
],
inspection:{
untested:"Inspect Untest",
passed:"Insp Pass",
failed:"Insp Fail"}}
我的绑定看起来像
<label class="btn btn-default"
ng-click="InspectClick('TestKey1', false)">
{{task.details.inspection.untested}}
<input type="radio" ng-checked="testKey1"
ng-disabled="!testDisable1" />
</label>
控制器:
(function () {
'use strict';
var controllerId = 'PreOpCtrl';
angular.module('app').controller(controllerId,
['$scope', buildPreOpCtrl]);
function buildPreOpCtrl($scope) {
//task already exists, this is known because of this working on all other browsers.
$scope.task.details = processDetails($scope.sourceData);
$scope.InspectClick = InspectClick(svalue, bvalue);
}
function processDetails(details) {
var ret = details;
//Convert stringify to objects
var i = ret.items;
var t = JSON.parse(i);
delete ret.items;
ret.items = t;
//correct bools
ret.showDeficiencyText = ret.showDeficiencyText === 'True' ? true : false;
ret.showCorrectiveText = ret.showCorrectiveText === 'True' ? true : false;
ret.correctiveActionSection = ret.correctiveActionSection === 'True' ? true : false;
//breakdown for marshal at later time.
ret.inspection = {
untested: ret.inspectionUntestedLabel,
passed: ret.inspectionPassedLabel,
failed: ret.inspectionFailedLabel,
};
return ret;
}
//stub code. real code isn't written yet.
function setInspectionException($scope)
{
return function (sval, bval) {
console.log(sval,bval);
};
};
})();
没有自定义指令。没有花哨的代码。我尽力保持这一点尽可能简单。
更新:我试图将所有ngIf指令更改为ngShow。页面速度变慢了,但问题没有解决。
答案 0 :(得分:0)
我相信这个问题已经通过更新版本的Angular解决了。我没有对我的代码进行任何更改,更新到最新版本,问题就消失了。
我仍然不知道是什么造成的。