viktor-shmigol / ng2-cable

Connect your Angular(2/4)/ionic(2/3) application with Rails ActionCable
https://ng2-cable-example.herokuapp.com
44 stars 14 forks source link

Broadcast method being instantiated twice when leaving a component and coming back again #16

Closed NuclearMachine closed 7 years ago

NuclearMachine commented 7 years ago

So when i enter a component that has a this.broadcaster method, leave and come back again, this.broadcaster is called twice. So whenever I receive a broadcast from the rails side, both the this.broadcaster methods from the ionic side will pick it up and will do whatever is inside twice! If I leave the 3rd time and come back, this.broadcaster is called thrice. This is a very serious bug that needs to be addressed asap.

NuclearMachine commented 7 years ago

so i solved it by this.broadcaster['_eventBus'].observers = [];