Publishing/Subscribing to events stopped working


The following code stopped working with the latest Ionic:

public onWhateverEvent() {

public authenticateUser(accessToken): boolean {
	console.debug('about to subscribe');"whatever", this.onWhateverEvent);
	console.debug('about to publish');"whatever");

Running this code results in the following error: TypeError: this._channels is undefined

Is there a new way to publish/subscribe?

Thank you,
Billy McCafferty

To clarify, I run into that error on both the subscribe and publish lines.

Looks likes a bug in the ionic framework (I know it’s in beta ;). I fixed it by adding the following at the top of .subscribe, .unsubscribe, and .publish within node_modules\ionic-framework\util\events.js:

	if (!this._channels) {
		this._channels = [];

Billy McCafferty

1 Like

Have you filled an issue for this? if not, do so or this could never be fixed on repo and this fix would only be known to the ones that were lucky to see it: Ionic issue form.

Also consider making a pull request for it.

Thanks for the suggestion…looks like it is fixed on the trunk.