I'm struggling to utilize the $document in the modals controller. Is there a proper way to pass it in? Just using document is not allowed according to our Angular project guidelines.
How I call the modal:
var modalInstance = $uibModal.open({
templateUrl: "errorsModal.html",
controller: ["$uibModalInstance", "data","vm", modalController],
controllerAs: "vm",
size:"md",
resolve: {
data: function () {
return referenceDataService.getErrors().$loaded();
},
vm: function (){
return vm;
}
}
});
}
The function inside Modals where I'm attempting to use $document:
function isTrueOrFalse(elementId,tickBoxElement,newData){
console.log(vm.check);
var checkBox = $document.getElementById(tickBoxElement);
checkBox.checked = !checkBox.checked;
updateErrors(newData,parentVm,true);
if(checkBox.checked === true){
checkBox.checked = false;
updateErrors(newData,parentVm,true);
}
else if(checkBox.checked ===false){
checkBox.checked = true;
updateErrors(newData,parentVm,false);
}
else{
checkBox.checked = true;
}
}