1.0.0 • Published 6 years ago
ir-events v1.0.0
ir-events
Events for angular 6 like ionic events. This is based on angular4-events package
Usage
in app.component.ts :
import { IrEventsService } from 'ir-events';
import { Subscription } from 'rxjs';
@Component({...})
export class AppComponent implements OnInit, OnDestroy {
evt: Subscription;
constructor(public event: IrEventsService) {}
ngOnInit() {
this.evt = this.event.create('evtName').subscribe((data) => {
// Your code here
});
}
ngOnDestroy() {
this.evt.unsubscribe();
}
}
in another component use this code :
import { IrEventsService } from 'ir-events';
@Component({...})
export class Home {
constructor(public event: IrEventsService) {
this.event.publish('evtName', data);
}
}