Get Access To Angular Service Instance From Javascript Code September 26, 2023 Post a Comment What I'm trying to do is have some testing assertions based on the data in the Angular service, i.e. we're trying to create E2E tests and the tool we're using allows us to executeSolution 1: This works for me in Angular 7 using ng.probe():window.ng.probe(window.getAllAngularRootElements()[0]) .injector.view.root.ngModule._providers .find(p => p && p.constructor && p.constructor.name === 'MyServiceName'); And I guess it is not possible to do it another way without ng.probe() Share Post a Comment for "Get Access To Angular Service Instance From Javascript Code"
Post a Comment for "Get Access To Angular Service Instance From Javascript Code"