2

I am just curious about whether it is possible. I have read this post How to access the angular $scope variable in browser's console? , so that I already know how to invoke the functions attached to a $scope from Chrome Console.

Say, I have a piece of code as follows(btw, I take the suggestions from AngularJS style guide for teams and AngularJS Style Guide):

(function() {
    'use strict';

    angular.module("appClubS")
        .controller("userRegisterCtrl", userRegisterController);

    userRegisterController.$inject = ['$scope', '$location', '$log', 'userFactory', 'passwordValidator'];

    function userRegisterController($scope, $location, $log, userFactory, passwordValidator) {

        // attach variables & functions to $scope here

        function validateUserInfo(userInfo) {
            // definition of function body
        }

    }

})();

Is there a way to access function validateUserInfo from Chrome Console? Thanks in advance.

Community
  • 1
  • 1
VincentZHANG
  • 757
  • 1
  • 13
  • 31
  • for temporary debugging purposes, you can just attach it to the window object somewhere in your userRegisterController function: window.validateUserInfo = validateUserInfo – David Ferretti Nov 07 '14 at 11:15

0 Answers0