Is it possible to obtain the reference of an Injectable Angular service within a generic class without including it in the constructor? I am exploring different methods to access the Service reference.
For example:
export class Utils {
getData(): string {
//Get Service reference without constructor
if(!isAuthorized()) return
//Do something
}
}
@Injectable({
providedIn: 'root'
})
export class AuthenticationService {
isAuthorized(): boolean {
//Perform actions
}
}