ng2-intercom

0.1.0 • Public • Published

Angular2 Intercom

This is an Intercom wrapper for Angular2 that also works with angular-universal It supports all intercom methods.

This was taken from: https://github.com/CaliStyle/angular2-intercom and turned into an NPM module by Chris Moyer.

All credit for the original development goes to Scott Wyatt (https://github.com/scott-wyatt).

Pre-requisites

Be sure to add a script tag including Intercom in your main HTML

Configuration

Import the IntercomModule in your AppModule

// Bootstrap
 
import { IntercomModule, INTERCOM_DIRECTIVES } from 'ng2-intercom';
 
@NgModule({
    imports: [
        IntercomModule,
        NgbModule.forRoot(),
    ],
    declarations: [
        ...INTERCOM_DIRECTIVES,
    ],
export class AppModule { }

Inject the Intercom service into your AppComponent to initialize it

// App
...
import { Intercom } from 'ng2-intercom/intercom';
 
@Component({
    selector: 'app',
    template: `...`
})
export class AppComponent implements OnInit {
    constructor(private intercom: Intercom){ }
 
    ngOnInit() {
        this.intercom.init({
            app_id: <app_id>,
            // Supports all optional configuration.
            widget: {
                "activator": "#intercom"
            }
        });
    }
}
 

Use it in HTML as an attribute directive:

 
<a [intercomTrackEvent]="'Click Link'">Link that's tracked</a>
<a [intercomNewMessage]="'Pre-populated message'">Request Help</a>
 

Package Sidebar

Install

npm i ng2-intercom

Weekly Downloads

1

Version

0.1.0

License

ISC

Last publish

Collaborators

  • kopertop