How to use $document in a Modal
up vote
-1
down vote
favorite
I am having trouble using $document in the modals controller. Is there a correct way of passing it in? I cant use just document as our angular project rules do not allow it
Calling 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;
}
}
});
}
Modals Function I am trying to use $document in
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;
}
}
javascript angularjs
add a comment |
up vote
-1
down vote
favorite
I am having trouble using $document in the modals controller. Is there a correct way of passing it in? I cant use just document as our angular project rules do not allow it
Calling 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;
}
}
});
}
Modals Function I am trying to use $document in
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;
}
}
javascript angularjs
In my view it is an AngularJs version of document
– Tom Edwards
2 days ago
So your using angular? You need to add the angular tag then
– Liam
2 days ago
yes it was my bad it wasn't included. i completely forgotten $document and such are angular. and not just standard
– Tom Edwards
2 days ago
1
You have to add $document through dependency injection of angularjs
– Nitesh Rana
2 days ago
Nitesh Rana already done. all dependencies are injected and running, i am using $document earlier in the code, but as Modal uses a separate controller within a controller, i have had to bring in the parent scope separately. I'm unsure how to do it with $document
– Tom Edwards
2 days ago
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I am having trouble using $document in the modals controller. Is there a correct way of passing it in? I cant use just document as our angular project rules do not allow it
Calling 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;
}
}
});
}
Modals Function I am trying to use $document in
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;
}
}
javascript angularjs
I am having trouble using $document in the modals controller. Is there a correct way of passing it in? I cant use just document as our angular project rules do not allow it
Calling 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;
}
}
});
}
Modals Function I am trying to use $document in
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;
}
}
javascript angularjs
javascript angularjs
edited 2 days ago
mplungjan
85.7k20120180
85.7k20120180
asked 2 days ago
Tom Edwards
358
358
In my view it is an AngularJs version of document
– Tom Edwards
2 days ago
So your using angular? You need to add the angular tag then
– Liam
2 days ago
yes it was my bad it wasn't included. i completely forgotten $document and such are angular. and not just standard
– Tom Edwards
2 days ago
1
You have to add $document through dependency injection of angularjs
– Nitesh Rana
2 days ago
Nitesh Rana already done. all dependencies are injected and running, i am using $document earlier in the code, but as Modal uses a separate controller within a controller, i have had to bring in the parent scope separately. I'm unsure how to do it with $document
– Tom Edwards
2 days ago
add a comment |
In my view it is an AngularJs version of document
– Tom Edwards
2 days ago
So your using angular? You need to add the angular tag then
– Liam
2 days ago
yes it was my bad it wasn't included. i completely forgotten $document and such are angular. and not just standard
– Tom Edwards
2 days ago
1
You have to add $document through dependency injection of angularjs
– Nitesh Rana
2 days ago
Nitesh Rana already done. all dependencies are injected and running, i am using $document earlier in the code, but as Modal uses a separate controller within a controller, i have had to bring in the parent scope separately. I'm unsure how to do it with $document
– Tom Edwards
2 days ago
In my view it is an AngularJs version of document
– Tom Edwards
2 days ago
In my view it is an AngularJs version of document
– Tom Edwards
2 days ago
So your using angular? You need to add the angular tag then
– Liam
2 days ago
So your using angular? You need to add the angular tag then
– Liam
2 days ago
yes it was my bad it wasn't included. i completely forgotten $document and such are angular. and not just standard
– Tom Edwards
2 days ago
yes it was my bad it wasn't included. i completely forgotten $document and such are angular. and not just standard
– Tom Edwards
2 days ago
1
1
You have to add $document through dependency injection of angularjs
– Nitesh Rana
2 days ago
You have to add $document through dependency injection of angularjs
– Nitesh Rana
2 days ago
Nitesh Rana already done. all dependencies are injected and running, i am using $document earlier in the code, but as Modal uses a separate controller within a controller, i have had to bring in the parent scope separately. I'm unsure how to do it with $document
– Tom Edwards
2 days ago
Nitesh Rana already done. all dependencies are injected and running, i am using $document earlier in the code, but as Modal uses a separate controller within a controller, i have had to bring in the parent scope separately. I'm unsure how to do it with $document
– Tom Edwards
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
-1
down vote
I have found my own workaround using angular.element("elementId")
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
-1
down vote
I have found my own workaround using angular.element("elementId")
add a comment |
up vote
-1
down vote
I have found my own workaround using angular.element("elementId")
add a comment |
up vote
-1
down vote
up vote
-1
down vote
I have found my own workaround using angular.element("elementId")
I have found my own workaround using angular.element("elementId")
answered 2 days ago
Tom Edwards
358
358
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372839%2fhow-to-use-document-in-a-modal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
In my view it is an AngularJs version of document
– Tom Edwards
2 days ago
So your using angular? You need to add the angular tag then
– Liam
2 days ago
yes it was my bad it wasn't included. i completely forgotten $document and such are angular. and not just standard
– Tom Edwards
2 days ago
1
You have to add $document through dependency injection of angularjs
– Nitesh Rana
2 days ago
Nitesh Rana already done. all dependencies are injected and running, i am using $document earlier in the code, but as Modal uses a separate controller within a controller, i have had to bring in the parent scope separately. I'm unsure how to do it with $document
– Tom Edwards
2 days ago