ngx-toastr icon indicating copy to clipboard operation
ngx-toastr copied to clipboard

Toastr not showing with server side event.

Open Arjun-Shinojiya opened this issue 4 years ago • 3 comments

I have one observable in my angular project which keeps catching events from server. The toaster in it is not working. Please check below code.

 const observable = Observable.create(observer => {
    const eventSource = new EventSource('https://dev.roomieads.com/roommate/get-profile-data');
    eventSource.onmessage = x => {
      console.log('x value', x);
      if(x.data !== 'No Data Found' ) {
        console.log('in if condition', x.data);
        this.toasterService.success(x.data, '', {positionClass: 'toast-bottom-left'}); 
      }
    eventSource.onerror = x => {
      console.log('error in x', x);
    };
});

Arjun-Shinojiya avatar Mar 02 '20 17:03 Arjun-Shinojiya