Comments (3)
I've always just used the default one in there. Since confirms actually block javascript code from running instead of how the modal works the modal makes it a little trickier. What I think would probably work best is to ALWAYS reject the $stateChangedStart with event.preventDefault(); and then if they are okay with going on replay whatever the route transition was. Thoughts?
from angularagility.
Something like this:
function (rootFormScope, rootForm, $injector) {
var confirmationMessage = 'You have unsaved changes are you sure you want to navigate away?';
var $state = $injector.get('$state');
rootFormScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
if (rootForm.$aaFormExtensions.$changed) {
event.preventDefault();
if (window.confirm(confirmationMessage)) {
$state.go(toState, toParams);
}
}
}
}
from angularagility.
👍
from angularagility.
Related Issues (20)
- Error messages are duplicated for input-boxes HOT 2
- Problem to notify error in Angular 1.3.16 HOT 2
- difference between AngularAgility and AngularAgility.Net? HOT 1
- FormExternalConfiguration and hierarchical viewmodel HOT 4
- what happened to $resetChanged(function() { }); in 0.8.26 HOT 12
- Consider adding angular-agility to NPM? HOT 3
- There are some validation errors: - But none shown in ul HOT 4
- Navigate Away Strategy
- Validation message on two inputs with same name HOT 3
- Changelog Needed HOT 2
- Angular2 HOT 1
- Wrong error handling in aaAjaxInterceptor could create AJAX infinite look HOT 1
- $reset() in latest version (0.8.36) clears the form empty, ignoring previous values
- NavigateAway modal shows up on state change even though form doesn't change HOT 5
- Module not found error when trying to import angular-agility HOT 1
- Submitting twice when aa-submit-form is used with type="submit" HOT 1
- aaNotify not showing notification when directive is inside view of controller HOT 1
- Get label text in ajaxValidationErrorMappingStrategy HOT 2
- $clearErrors - (thisForm.$setUntouched || angular.noop)(); Lost context inside angularjs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angularagility.