Skip to content

angular2-busy not working when calling Observer.error() #83

@samih-dev

Description

@samih-dev

Hi,

I'm having the following code testing the module:

`import { Component, OnInit } from '@angular/core';
import { Subscription } from "rxjs/Subscription";
import { Observable } from "rxjs/Observable";
import { Observer } from "rxjs/Observer";
import { IBusyConfig } from "angular2-busy";
import 'rxjs/add/operator/delay';

@component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
busyConfigSettings: IBusyConfig
busy: Subscription;
ngOnInit(){

this.busyConfigSettings = {
  delay: 0,
  minDuration: 0,
  message: 'loading...',
  busy: null,

}

this.busyConfigSettings.busy = this.generateObservable().subscribe(
  () => { // success
    console.log('logic for success');
  },
  () => { // error 
    console.log('logic for error');
  },
  () => { // complete
    console.log('logic for compelete');
  });

}

generateObservable(): Observable{
return Observable.create((observer: Observer) => {
observer.error("Notify about error, expecting loader to be hidden after this.");
// observer.next(null);
observer.complete();
}).delay(5000);
}
}
`

calling Observer.next is working as expected, but when trying to call observer error, loading isn't showing at all, and sometimes I got exception regarding the change detection for Angular.

Any help? seems not supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions