js 1.3 with jquery. I have to display a form input in modal window. For which I have written a jquery function which will open the hidden dom content in Modal window.
ShowModal.open({
content: $(".modal_content").html(), //Get html content form dom
})
Code for modal is working fine. The problem is the modal is not getting the controller's scope. I am using "Controller As" syntax for controller:
function controller(){
bindVm = this;
bindVm.data = ["Hello", "World"]
}
In Modal window
<div ng-controller="controller as bindVm">
<div class="modal_content"> {{bindVm.data[0]}}</div>
</div>
The controller's code is working fine for normal page, but not working in modal window.
Note : I am also attaching html content using $compile
$modalContent.html($compile($modal_content)($scope));
Still not working. Anybody got something.
In modal you need to resolve your variables or scopes and pass to modal controller then you can start to use them check here Angular-UI Modal resolve
Pass parameter to modal
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With