I am just trying to mock up my http calls with a simple BehaviorSubject and an Observable properties in my resolver service. I do not understand why the following is not working:
schedule-administration.service.ts:
@Injectable({
providedIn: 'root'
})
export class ScheduleAdministrationService implements OnInit, Resolve<Observable<SportType[]>> {
private _sportTypesSubject = new BehaviorSubject<SportType[]>([]);
sportTypes$: Observable<SportType[]> = this._sportTypesSubject.asObservable();
constructor(private leagueAdminService: LeagueAdministrationService) {}
resolve(): Observable<SportType[]> | Observable<Observable<SportType[]>> | Promise<Observable<SportType[]>> {
this._sportTypesSubject.next([...])
return this.sportTypes$;
}
}
I thought that the resolve method is supposed to subscribe to the returned observable? When I manually do this.sportTypes$.subscribe(v => console.log(v)) it correctly logs the values....