to make it better, I would suggest you change the code to see something below
Template:
<div class='ng-modal' ng-show='modalContent != null && modalContent != ""'> <div class='ng-modal-overlay' ng-click='hideModal()'></div> <div class='ng-modal-dialog' ng-style='dialogStyle'> <div class='ng-modal-close' ng-click='hideModal()'>X</div> <div class='ng-modal-dialog-content' ng-transclude></div> <p>{{ modalContent }}</p> </div> </div>
Directive
app.directive('modalDialog', function() { return { restrict: 'E', scope: { modalContent: '=' }, replace: true,
and then use the code as shown below in the template
<modal-dialog modal-content='modalMsg' width='750px' height='90%'></modal-dialog>
Once these changes are completed, you can write a function to set the message in the variable "modalMsg" and angular will take care of the rest
Note: The code is basically the same as in the link, the only thing I changed is checking the display of the modal window
S4beR source share