I would like to call my ApiService
from a browser console.
I tried what explained in Call a service function from browser console in angular 6:
@Injectable({
providedIn: 'root'
})
export class ApiService {
constructor(private http: HttpClient) {window['myService'] = this}
Which is causing compiling error:
Error: ../services/api.service.ts:12:49 - error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
12 constructor(private http: HttpClient) {window['ApiService'] = this; }
I also tried to run this from console:
angular.element(document).injector().get('ApiService');
But angular dependencies do not seem to be loaded as I get the following error:
Uncaught ReferenceError: angular is not defined
<anonymous> debugger eval code:1
Any clue to progress on this topic?