Within my Angular2 application, I am utilizing a communication service to handle interactions between components.
When calling the method:
this.notification.create('test');
The service structure is as follows:
export class NotificationService {
private static notificationSource = new Subject<any>()
notiCreated$ = NotificationService.notificationSource.asObservable();
create(message) {
NotificationService.notificationSource.next(message);
}
}
The function being called is:
this.subscription = notification.notiCreated$.subscribe(
data => {
console.log(data);
this.createNotification(data, 'warning');
});
However, there arises an issue when attempting to pass two parameters. How can this be achieved?