I am using service with subject as communication service for components in my angular2 application.
Calling method:
this.notification.create('test');
Service:
export class NotificationService {
private static notificationSource = new Subject<any>()
notiCreated$ = NotificationService.notificationSource.asObservable();
create(message) {
NotificationService.notificationSource.next(message);
}
}
Called function:
this.subscription = notification.notiCreated$.subscribe(
data => {
console.log(data);
this.createNotification(data, 'warning');
});
But I want to pass 2 params. And I got errors.
How can i do it?