0

I'm using the angular-cli system to build an angular app. During debugging with ng serve I find my self using the developer tools to manipulate and check variables.

The problem is that I'm constantly running the same js script, to find the angular component on the page and then getting the component instance etc...

var element = document.getElementsByTagName("my-app-component")[0];
var comp = ng.probe(element).componentInstance;
var myService = comp.myService;

Can I insert this script into the development environment settings somehow?

ng serve --target=development --environment=dev

I'm unsure from the documentation, on how to do this.

2
  • 1
    Did you try Augury? You can access selected component with $a in dev tools with it... Commented Nov 16, 2016 at 8:47
  • Augury wasn't working with my app before, but it is now. Also, didn't know that command existed, thanks! Commented Nov 16, 2016 at 12:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.