Skip to content
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

Form set to dirty when redactor is initialized #50

Open
benfoster opened this issue Jul 27, 2015 · 2 comments
Open

Form set to dirty when redactor is initialized #50

benfoster opened this issue Jul 27, 2015 · 2 comments

Comments

@benfoster
Copy link

We're tracking the dirty state of the form. When redactor is initialized the $dirty flag is set to true. This should be reset after initialization.

@benfoster
Copy link
Author

After further investigation it looks like this is partly caused by wrapping $scope.$apply in $timeout. It is my understanding that Angular already wraps $timeout in an $apply call, but perhaps there was a good reason for doing this?

        var updateModel = function updateModel(value) {
          // $timeout to avoid $digest collision
          $timeout(function () {
            scope.$apply(function () {
              ngModel.$setViewValue(value);
            });
          });
        },

After changing to:

        var updateModel = function updateModel(value) {
          // $timeout to avoid $digest collision
          $timeout(function () {
              ngModel.$setViewValue(value);
          });
        },

We no longer have the "dirty" issue and everything continues to work as expected.

@rkingon
Copy link

rkingon commented Oct 2, 2015

PR for this here: #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants