angularjs - How to Check for unsaved changes when switching nested views in a same Page? -


when switch between 1 state state here able check unsaved changes , can ask user conformation before moving 1 page in same view have multiple forms in if switch between 1 form form first i have to give message user sure u want leave page without saving data can move form how can this.

example of multiple forms in same view below have metioned

<div ng-switch-when="formtab">   <div ng-include="'/views/tmpl/workform.html'"></div> </div> <div ng-switch-when="efforttab">    <div ng-include="'/views/tmpl/workeffort.html'"></div> </div> 

in above example while moving formtab efforttab need show unsaved changes message

use $dirty property of form:

console.log(myform.$dirty); 

plunker


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -