-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to apply the directive AFTER data is loaded through HTTP? #46
Comments
Can you post how you are loading data. Form dirty normally doesn't get set unless you are triggering user events. |
Basically making a call to an HTTP service, which returns an object (in a predetermined format), and then I bind that object to scope in a controller. The UI template uses this controller, and I'm using 'ng-model' (on the $scope object properties) to display the object properties in the UI EDIT: After I load the controller/template with the form, the log states 'all forms are clean'. However, when I try to click another object (which loads a new form), I then get a log message stating 'a form is dirty', even after I've made 0 clicks on the UI (aside from opening up a new form). |
It seems like $pristine() is called after the directive loads, but before the HTTP call has finished. |
Make sure your form is in $pristine state while it is loading data. Perhaps a specific control your are using is setting your form as $dirty. It may help to pinpoint the exact source of error if you put a breakpoint on $setDirty() to see who is calling that. |
Any time I add values to a form (that are loaded through HTTP), this library always thinks my form is dirty. Any easy workaround? I want the dirty check to start taking place only after a form is initialized.
Thanks a ton for your quick guidance.
The text was updated successfully, but these errors were encountered: