Как вызвать другую функцию в функции обратного вызова channel.bind из pusher? - PullRequest
0 голосов
/ 03 июля 2019

Я использую pusher в Angular 8 и пытаюсь вызвать функцию и директиву Angle 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..
...