找出Angular2中的调用者函数,Typescript

Mar*_*thy 5 ionic2 angular

我想在我的angular2 / ionic2项目中找出特定函数的调用者函数。.arguments.callee.caller.toString()不好运

任何的想法?

Jos*_*osh 8

我知道这有点晚了,但我遇到了同样的问题,希望这会对其他人有所帮助。

您可以通过执行以下操作来生成堆栈跟踪

console.log((new Error).stack);
Run Code Online (Sandbox Code Playgroud)

这将显示哪个函数调用了您的特定函数