我在Angular 8中使用了pusher,并且试图在此代码中调用函数和angular的Renderer指令?
var channel = pusher.subscribe('my-channel');
channel.bind('my-event', function (data) {
console.log(JSON.stringify(data));
this.functionname();
this.renderer.addClass(this.elref.nativeElement,'badge1');
});
但是我遇到错误
Cannot read property 'addClass' of undefined
at Channel.Dispatcher.emit
和
this.functionname() is not a function..