Quantcast
Channel: Is there a pattern for dealing with "Cancel" in AngularJS modal dialogs? - Stack Overflow
Browsing all 7 articles
Browse latest View live

Answer by dalcam for Is there a pattern for dealing with "Cancel" in...

Another way is to copy the model before editing it, and on cancel, restore the original. Angular Controller Code: //on edit, make a copy of the original model and store it on scope function...

View Article



Answer by Silvan Hofer for Is there a pattern for dealing with "Cancel" in...

As of Angular 1.3 there is ngModelOptions directive that allows to achive the same behaviour natively. <form name="userForm"> <input type="text" ng-model="user.name" ng-model-options="{...

View Article

Answer by Dizzypointed for Is there a pattern for dealing with "Cancel" in...

Here's my try at keeping it simple, making it declarative and not dependent on form tags or other stuff. A simple directive: .directive("myDirective", function(){ return { scope: { item: "=myDirective"...

View Article

Answer by vitalets for Is there a pattern for dealing with "Cancel" in...

Facing the same problem and going though this thread I came up with lazy-model directive that works exactly like ng-model but saves changes only when form was submitted. Usage: <input type="text"...

View Article

Answer by garst for Is there a pattern for dealing with "Cancel" in AngularJS...

Basically, in angular if something is not declarative, you make a directive. .directive('shadow', function() { return { scope: { target: '=shadow' }, link: function(scope, el, att) { scope[att.shadow]...

View Article


Answer by Sharondio for Is there a pattern for dealing with "Cancel" in...

You seem to be over-thinking this. There isn't a plug-in because the process is pretty simple. If you want a pristine copy of the model, make one and keep it in the controller. If a user cancels, reset...

View Article

Is there a pattern for dealing with "Cancel" in AngularJS modal dialogs?

Note: This is not about showing a modal dialog with AngularJS, that topic has plenty of questions and answers! This question is about how to react to both OK and Cancel within a modal dialog on a...

View Article
Browsing all 7 articles
Browse latest View live




Latest Images