Angular Intercom
This is an Intercom wrapper for Angular 2+ with dependency injection for universal applications.
It supports all documented intercom methods.
BETA VERSION
master
is now hosting the 1.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!
Installation
This package is on NPM, so just run
$ npm install ng-intercom@beta --save
Configuration
- 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>,
updateOnRouterChange: true
})
...
]
})
export class AppModule { }
- Use in your components/directives/whatever you want!
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.init({
app_id: <app_id>,
widget: {
"activator": "#intercom"
}
});
}
}
Development
To compile, just run npm run build
. It will compile into the dist directory.
Credits
Maintained by Scott Wyatt and Wilson Hobbs in 2017 with contributions from Florian Reifschneider, Devon Sams, and Humberto Rocha