-
Notifications
You must be signed in to change notification settings - Fork 2
Description
simple code just like below throws error
import { Component } from '@angular/core';
import { TawkMessengerAngular } from '@tawk.to/tawk-messenger-angular/dist/tawk-messenger-angular';
@component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
title = 'test-tawk';
constructor(public TawkMessengerAngular: TawkMessengerAngular) {}
ngOnInit(): void {
this.TawkMessengerAngular.init({
propertyId: "[propertyId]",
widgetId: "[widgetId]",
});
}
}
main.ts:6 ERROR Error: inject() must be called from an injection context
at injectInjectorOnly (core.mjs:4761:15)
at Module.ɵɵinject (core.mjs:4771:60)
at Object.TawkMessengerAngular_Factory [as factory] (tawk.to-tawk-messenger-angular.mjs:220:106)
at R3Injector.hydrate (core.mjs:9301:35)
at R3Injector.get (core.mjs:9189:33)
at ChainedInjector.get (core.mjs:13009:36)
at lookupTokenUsingModuleInjector (core.mjs:4436:39)
at getOrCreateInjectable (core.mjs:4484:12)
at Module.ɵɵdirectiveInject (core.mjs:10780:12)
at NodeInjectorFactory.AppComponent_Factory [as factory] (app.component.ts:8:26)