Our angularJS web components are integrated with a jqxGrid. Whenever a user makes edits in a cell, we implement a custom typeahead editor using Angular. However, I have noticed that after the editor is destroyed, my $watches array does not revert back to its original value.
To address this issue, I am creating a new isolateScope for my directive, which is then compiled and appended to the DOM element provided by JQX when the editor is required:
var scope = $rootScope.$new(true);
var customEditor = $compile(directive)(scope);
I am seeking guidance on how to properly clean up these $watches. What steps should I take?