CaliStyle / ng-intercom

Angular 7+ Wrapper for Intercom.com
MIT License
54 stars 46 forks source link

TypeError: Cannot read property 'boot' of undefined #65

Closed JohnnyTMD closed 5 years ago

JohnnyTMD commented 5 years ago

I have installed the module following the instructions and i get this error ”TypeError: Cannot read property 'boot' of undefined”. Here is the code:

` public intercom: Intercom constructor() { }

ngOnInit() { this.intercom.boot({ /// <--- on this line is the error app_id: 'app-id', widget: { "activator": "#intercom" } }); }`

justinasit commented 5 years ago

You should inject intercom provider into the component like this: constructor(private intercom: Intercom) {}

wbhob commented 5 years ago

@justinasit is right. Injectable providers must go in constructor, not outside of it.