JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q56117F
  • License ISC

NG2 Intercom integration. See https://github.com/CaliStyle/angular2-intercom

Package Exports

  • ng2-intercom

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ng2-intercom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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>