How to debug Angular JavaScript Code

前端 未结 13 2002
离开以前
离开以前 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:08

    var rootEle = document.querySelector("html");
    var ele = angular.element(rootEle); 
    

    scope() We can fetch the $scope from the element (or its parent) by using the scope() method on the element:

    var scope = ele.scope();
    

    injector()

    var injector = ele.injector();
    

    With this injector, we can then then instantiate any Angular object inside of our app, such as services, other controllers, or any other object

提交回复
热议问题