1

I've built a simple Angular 2 App - for learning purposes and deploy it to Heroku, set PRODUCTION = TRUE in environment.ts but it seems like i can't add breakpoints in the chrome debugger, the web pack folder isn't shown in the Sources panel - in the developer tools....perhaps there is a way to expose the .ts files and stay in production mode?

6
  • Why not debug using dev mode instead? which is why it does exists; to help debugging Commented May 2, 2018 at 10:29
  • Thanks - that's because it's going to be an inner organization app - and the client wants to be able to debug from users computers - and not from the server Commented May 2, 2018 at 10:33
  • Then make it dev mode Commented May 2, 2018 at 10:34
  • @FindOutIslamNow thanks - that's one way for sure - but perhaps there is a better way? Commented May 2, 2018 at 10:35
  • 1
    stackoverflow.com/questions/45800032/… Commented May 2, 2018 at 10:36

1 Answer 1

1

use debugger keyword wherever you need to debug.

getData() {
   debugger
   // your code to get data
}

open up the browser developer tool then you'll see the magic

for step-in, use F-10 key (in windows)

for continue, use F-8 key (in windows)

for more, visit: Seven Methods for Debugging Angular Applications

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks - that's very helpful!
@RoyBarOn Please don't forget to mark as answer if it helped you
How can it help in this situation, i can't add breakpoints in the chrome debugger, the web pack folder isn't shown in the Sources panel? A breakpoint is set up on gibberish source code.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.