How to debug Angular JavaScript Code

前端 未结 13 2046
离开以前
离开以前 2020-12-04 06:48

I am working on a proof of concept using Angular JavaScript.

How to debug the Angular JavaScript code in different browsers (Firefox and Chrome) ?

13条回答
  •  执念已碎
    2020-12-04 07:07

    You can add 'debugger' in your code and reload the app, which puts the breakpoint there and you can 'step over' , or run.

    var service = {
    user_id: null,
    getCurrentUser: function() {
      debugger; // Set the debugger inside 
                // this function
      return service.user_id;
    }
    

提交回复
热议问题