What I am trying is, to disable the action of close in ng-dialog pop up until any other button is clicked.I want to do that until I give some text on input in pop up and click on save button the pop up should not be closed either by into (*) mark
Asked
Active
Viewed 4,359 times
2
-
1If I am not wrong then you wants to disable the close button untill from in pop up is not valid, Right? – Satyam Koyani Oct 08 '15 at 07:06
2 Answers
4
Suppose you have a template of pop up like below :
<button type="button" ng-click="closeThisDialog('button')" ng-disabled="demoForm.$invalid" class="btn btn-default pull-right">x</button>
<br>
<form name="demoForm">
<h3>Close button disabled untill no input</h3>
<p>Here input field is required so untill input box is not valid you cannot close the dialoug.</p>
<p>Once you enter the input close btn will be enabled</p>
<input ng-model="confirmValue" required/>
<br>
<br>
<button type="button" ng-disabled="demoForm.$invalid" ng-click="closeThisDialog('button')" class="btn btn-default">Cancel</button>
<button type="button" class="btn btn-default">Save</button>
</form>
You can add form in your pop-up template just shown in above template.
Now as per your requirement user should not close the popup until he didn't enter any input so there is validation in form.
Just disable close button until form is not valid.
Check out this demo
You can refer more here in doc of ng-dialog.

Satyam Koyani
- 4,236
- 2
- 22
- 48

Yogeshree Koyani
- 1,649
- 10
- 19
-
-
It all has some mistakes right...bcoz when ever i open add form the pop up is coming.and its evn getting closed even if we does write into the input nd and save button is clicked – Vindya Veer Oct 08 '15 at 07:43
-
@VindyaVeer Check out edited answer. Changed explanation of answerer NetSonu. – Satyam Koyani Oct 08 '15 at 08:37
-
1
the easiest way of having control over ngDialog via buttons is to change the default boolean of closeByDocument and showClose to false. Then you can only use buttons to exit.

Stuck-Over-Flow
- 75
- 1
- 10