0

As I understand from this question Global variables in AngularJS I have got basically 2 options for "global" variables:

So, for example, I have $rootScope.myVar. How can I get it through the console? Like if myVar is an object with some methods and I need to call one of its method.

kliukovking
  • 569
  • 1
  • 5
  • 16
  • Why exactly do you need this? "Global" on the root scope still doesn't mean "global" in Javascript scope. And calling things from outside Angular is… weird at best. – deceze Jul 31 '17 at 07:09
  • @deceze I understand that, so there is no way to get access to this variables, yes? Only if I make them "global" in javasript and outside the angularjs? – kliukovking Jul 31 '17 at 07:11
  • Yeah, you shouldn't be doing that… again: what for? Purely for debugging you can set breakpoints in your browser's debugger and evaluate any expression is any scope. – deceze Jul 31 '17 at 07:13
  • 2
    If you want to access a variable in angularjs that is in javascripts scope, then check https://stackoverflow.com/questions/19383725/how-to-access-global-js-variable-in-angularjs-directive – Vivz Jul 31 '17 at 07:14
  • 1
    @Vivz Thanks, thats what I've asked! – kliukovking Jul 31 '17 at 07:21

0 Answers0