无法在回调函数中访问Angular作用域

时间:2019-11-20 12:31:40

标签: javascript angular typescript callback

我有一个如下所示的角度回调函数。

blob= "(function(params1, params2, this.clientCallback) {})();";
serverBundle = eval(blob); // evaluating the above received bundle file as a blob.

clientCallback() { } //unable to access any thing which is outside this block. like.. 'this', 'httpClient' etc.. 

// calling above evaluated method and passing the callback method here.
serverBundle(params1, params2, this.clientCallback);

试图了解如何访问“ clientCallback()”方法中的角度范围?

请帮助。谢谢!

0 个答案:

没有答案