I am working on a directive that conditionally listens for events, and logs 
accordingly.  I'm having an issue with the unregister function, but it 
seems only during test execution.  In product code, calling the listen 
function result correctly unregisters the event.  For example, the 
following code will deregister the listener outside of a test (Jasmine):

this.listener = this.renderer.listen(target, 'click', this.onClick);    
this.listener();

I've distilled the problem down to two Plunkers, one that counts the clicks 
in tests <https://plnkr.co/edit/fNs1uj4JoaRf9LzJGn2P?p=preview>, and one 
that counts the clicks on rendered code 
<http://plnkr.co/edit/nzuPC13h1IOyMRHmbprn?p=preview>.  Both plunkers are 
using the same component/directive code.

Any help is appreciated.  Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
  • [AngularJS] Even... 'Joe Allan Muharsky' via Angular and AngularJS discussion
    • [AngularJS]... Sander Elias
      • Re: [An... 'Joe Allan Muharsky' via Angular and AngularJS discussion
        • Re:... 'Joe Allan Muharsky' via Angular and AngularJS discussion
        • Re:... Sander Elias
          • ... 'Joe Allan Muharsky' via Angular and AngularJS discussion

Reply via email to