I need to call/subscribe to the external service observable method and take value from it. I try it, it component constructer but always return undefined. I examine put console.log inside the method the value is there. need some expert helpt to take this object ->string value in angular.
this.x:string;
constructor(
private readonly socService: ocService) { }
ngOnInit(): void {
this.ocService.getActiveoc().subscribe(oc => { this.x= oc.id });
//TODO For Testing
if(this.x){
console.log("ID" + this.x)
this.store.dispatch(selectPatientAction({ x: this.x}));
}
}
onScanX() {
this.store.dispatch(scanX({x: this.x }));
this.isocSelected = true;
}