I have MyService which is injected into ComponetA and ComponetB .
Is it possible to find out from which component is the MyService.myMethod() called?
@Injectable()
export class MyService {
public myMethod(): void {
console.log('called from component: ' + component);
}
}
Only solution would be to use a parameter which would be passed to the called function.
EDIT: Previous suggestion to refer here would not work because it only works without strict mode.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.