How to Check for a NULL Result from an Angular 5 RxJS Observable during Subscription?
问题 With RxJS Observables within Angular this.myService.getEmp(personEmpId).subscribe( result => { this.personName = result.person_name; }, error => { console.log("EE:",error); } ); How can I test if my subscription to this service returns a NULL result, i.e. no record was found at all? I tried adding the error part but this did not fire the console message. At the moment, I seem to be getting the following error message: ERROR TypeError: "result is null" 回答1: You can add a filter before