I have a service with a method.
This method subscribes in the service and not in the component.
The result is in message.content.
Here is the code:
Service Method:
myMethod() {
this.socket$.subscribe(
(message) => {
console.log(`${message.content}`);
}
);
}
App Component
contentVariable;
ngOnInit() {
this.myservice.myMethod();
}
My question is...how do I get message.content from the service into contentVariable in my component?
return this.socket$.subscribe()componentthis.contentVariable = this.myservice.myMethod();