Reputation: 557
Working on a Single Page Application in Angular 8 whereby am parsing some data from a component to a service, then in the service I subscribe to it using rxjs BehaviorSubject.on compilation on Angular CLI I get this error src/app/Services/shared.service.ts(12,21): error TS2554: Expected 1 arguments, but got 0.
Cant seem to locate what the issue is?
shared service
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { TokenService } from './token.service';
@Injectable({
providedIn: 'root'
})
export class SharedService {
//All children
private children = new BehaviorSubject;
checkAll$ = this.children.asObservable();
childData(data:any){
this.children.next(data);
}
constructor(private Token : TokenService) { }
}
Upvotes: 0
Views: 1131
Reputation: 8251
BehaviorSubject
needs an argument. You didn't provide it.
private children = new BehaviorSubject(null);
Upvotes: 1