Skip to content

CaliStyle/ng-intercom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4d9d574 · Sep 21, 2020
Sep 21, 2020
Oct 16, 2018
Jun 8, 2018
Jul 20, 2017
Jan 11, 2020
Feb 11, 2019
Feb 25, 2018
Aug 14, 2018
Apr 28, 2017
Jan 15, 2018
Aug 23, 2017
Feb 7, 2019
Jul 3, 2018
May 10, 2018
Apr 26, 2019
Jan 27, 2020
Sep 21, 2020
Feb 25, 2018
Feb 25, 2018
Dec 5, 2018
Feb 7, 2019
May 10, 2018
Jul 24, 2018

Repository files navigation

ng-intercom

npm npm Build status Maintenance

This is an Intercom wrapper for Angular 2+ which supports AoT and SSR.

It intends to supports all documented intercom methods and PRs for functionality is greatly appreciated.

BETA VERSION

master is now hosting the 7.0.0 beta version of ng-intercom. If you need to make changes to the latest stable version, please PR against 0.x.x. If you need to use the last 0.x version, please run npm install --save --save-exact ng-intercom@0.2.

If you find issues with this version, please file an issue as soon as possible so we can take a look at it. We appreciate your cooperation!

ALPHA VERSION

If you want to try the latest features, check out the 7.0.0-alpha branch! Features include automatic script loading and intercom directives! If you find an issue, please report it!

Installation

This package is on NPM, so just run

$ npm install ng-intercom@latest --save

Configuration

  1. Import IntercomModule to app.module.ts. The module will automatically include the APP_ID instantiation, so you DO NOT need to copy the install script from Intercom and place it in your index.html.
import { IntercomModule } from 'ng-intercom';

@NgModule({
  imports: [
    ...
    IntercomModule.forRoot({
      appId: <your_app_id>, // from your Intercom config
      updateOnRouterChange: true // will automatically run `update` on router event changes. Default: `false`
    })
    ...
  ]
})
export class AppModule { }
  1. Use in your components/directives/whatever you want!
// App
import { Component, OnInit } from '@angular/core';
import { Intercom } from 'ng-intercom';

@Component({
  selector: 'app',
  template: `...`
})
export class AppComponent implements OnInit {
  constructor(
    public intercom: Intercom
  ){}

  ngOnInit() {
    this.intercom.boot({
      app_id: <app_id>,
      // Supports all optional configuration.
      widget: {
        "activator": "#intercom" 
      }
    });
  }
}

Development

To run live testing: ng test

To run tests: npm test

To run distribution: npm run build:dist

To publish npm run build:dist && npm publish dist

Credits

Maintained by Scott Wyatt and Wilson Hobbs in 2017 with contributions from Florian Reifschneider, Devon Sams, Humberto Rocha, and Luca GOUTY