import {Events} from 'ionic-angular';
import {Events} from '../your/path/to/service/events';
events.subscribe('user:created', (user, time) => {
console.log('Welcome', user, 'at', time);
});
this.events.subscribe('user:created', (data: any) => {
console.log('Welcome', data.user, 'at', data.time);
});
this.events.publish('user:created', someUserInstance, Date.now());
this.events.publish('foo:user:logged-out', {
user: someUserInstance,
time: new Date()
});
const subscription = this.events.subscribe('user:foo:created', (data: any) => {
// your logic
});
Once you are done, you can do this-
subscription.unsubscribe();
Hey I want to say thats alot for this amazing collection of code. I've imported it into my project but i've been getting some problems getting it to work, is there anyway you can assist me?