Angular JS在IE11和FireFox中完美结合,没有错误。但是在Chrome中,仍然没有错误,绑定在UI控件中失败,但是在平面文本转储中,它呈现良好。
铬
火狐
IE11
苹果浏览器
尽管我没有图像,但是绑定也可以在Safari中使用。
我怀疑这一定是脚本冲突,但是我似乎找不到它。
这是我正在加载的脚本,并按加载顺序排列。
jquery- {version} .js
jquery-ui- {version} .js
Common.js //针对Java数组的IE 8和9兼容性原型
moment.js
moment-timezone.js
toastr.js
angular.js
angular-route.js
angular-resource.js
angular-recursion.js
angular-loader.js
angular-animate.js
angular-cookies.js
angular-sanitize.js
angular-scenario.js
angular-touch.js
angular-draganddrop.js
ui-bootstrap.js
ui-bootstrap-tpls.js
ui-utils.js
ui-utils-ieshiv.js
textAngular.js
textAngular-sanitize.js
app.js //我的代码
textAngularSettings.js /我的设置
此控件的“我的数据”结构是:
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。页面变慢,但是问题没有解决。
最佳答案
我相信这个问题已通过较新版本的Angular解决。我没有对我的代码进行任何更改,更新为最新的发行版,问题就消失了。
我仍然不知道是什么原因造成的。