Freshdesk widget for Angular 8+
Via npm:
npm install ngx-freshdesk-webwidget --save
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { NgxFreshdeskWebwidgetModule } from 'ngx-freshdesk-webwidget';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
NgxFreshdeskWebwidgetModule.forRoot()
],
bootstrap: [AppComponent]
})
export class AppModule { }
@NgModule({
exports: [
CommonModule,
NgxFreshdeskWebwidgetModule
]
})
export class SharedModule { }
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NgxFreshdeskWebwidgetModule, NgxFreshdeskWebwidgetConfig } from 'ngx-freshdesk-webwidget';
import { AppComponent } from './app';
export class FreshdeskConfig extends NgxFreshdeskWebwidgetConfig {
widgetId = 00000000000;
locale = 'en';
callback(FreshworksWidget) {
FreshworksWidget('hide');
}
}
@NgModule({
imports: [
BrowserModule,
HttpClientModule,
NgxFreshdeskWebwidgetModule.forRoot(FreshdeskConfig)
],
bootstrap: [AppComponent]
})
export class AppModule { }
import { NgxFreshdeskWebwidgetService } from 'ngx-freshdesk-webwidget';
@Component({
selector: 'app',
templateUrl: './app.html'
})
export class app {
constructor(private _NgxFreshdeskWebwidgetService: NgxFreshdeskWebwidgetService) { }
}
constructor(private _NgxFreshdeskWebwidgetService: NgxFreshdeskWebwidgetService) {
this._NgxFreshdeskWebwidgetService.FreshworksWidget('identify', 'ticketForm', {
name: 'Fulano Detal',
email: '[email protected]',
});
this._NgxFreshdeskWebwidgetService.FreshworksWidget('show');
}
logout(){
this._NgxFreshdeskWebwidgetService.FreshworksWidget('hide');
}
buttonClick(){
this._NgxFreshdeskWebwidgetService.FreshworksWidget('open', 'ticketForm');
}
buttonClickArticle(articleId: number){
this._NgxFreshdeskWebwidgetService.FreshworksWidget('open', 'article', {
id: articleId
});
}
FreshworksWidget
. Please see Freshdesk Documentation for more information.
widgetId
: Number of your Freshdesk Web Widget ID.locale
: To force the widget to load in a particular language.callback
: Callback, executed after Freshdesk loaded.
Please report bugs and issues here.
MIT © Alison Vilela
- Anuglar 10 support
- Added documentation
- Initial version