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

Feature Request: ChangeCallBack feature #134

Open
System64 opened this issue Jul 22, 2016 · 6 comments
Open

Feature Request: ChangeCallBack feature #134

System64 opened this issue Jul 22, 2016 · 6 comments

Comments

@System64
Copy link

Hi,
Wouldn't it be great to have a changeCallBack option, alike pasteCallBack.
I have modified the code and have implemented change callback by binding "DOMSubtreeModified" event with debounce, so that it won't get called so often. Is it a good approach, any suggestion would be good.

@bampakoa
Copy link
Contributor

Could you please provide more info on the need of this event or even better, describe the scenario that you are trying to achieve?

@System64
Copy link
Author

@bampakoa: change call back has many uses, like in my cases, I would like to perform some activity if there is any changes in the editor, like disable some other fields or change some texts, or show count of characters.

@bampakoa
Copy link
Contributor

You could detect any changes that happen on the editor by watching ngModel attribute in your code:

@System64
Copy link
Author

Yes watching ngModel can be done but don't you think it will increase the number of watcher for angular.

@bampakoa
Copy link
Contributor

bampakoa commented Jul 26, 2016

I don't think you have to worry so much about that, as the latest version of Angular >= 1.5 has many performance improvements. Nevertheless, it always depend on your code (if you are using already many watches etc....). Also, it would be better to watch the model rather than polluting the rootScope with an event.

Just to clarify also that when you add a watch, that counts for 1 watch no matter how many times the event will fire.

@System64
Copy link
Author

Yeah, that is the whole reason I am avoiding using it with watch, there are already a lot of things being watched.

No, I don't have to put it in rootScope, I have bind it with JQuery 's "DOMSubtreeModified" event.

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