3

I want to see an Angular stack trace when a specific function is called twice, which seems odd but is the intended behavior https://github.com/angular/angular.js/issues/1146.

use strict disables arguments.callee.caller.toString() to print the call stack.

How can I log the caller of a named function in Angular?

Dylan Valade
  • 5,565
  • 6
  • 42
  • 56
  • 1
    Don't use strict mode? :-0 Maybe [*Arguments.callee is deprecated - what should be used instead?*](http://stackoverflow.com/questions/8361642/arguments-callee-is-deprecated-what-should-be-used-instead) helps (i.e. using named function expressions)? – RobG Jan 19 '15 at 03:34
  • I like strict mode. Named function expressions might be promising, thanks for the link. – Dylan Valade Jan 19 '15 at 17:18

1 Answers1

1

You can produce a stack trace by doing console.log((new Error).stack);

Josh
  • 321
  • 2
  • 15