Angular Intercom
This is an Intercom wrapper for Angular 2+ with dependency injection for universal applications.
It supports all intercom methods.
ALPHA VERSION
If you want to try the latest features, please see the 1.0.0-alpha
branch.
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';
import { AppComponent } from './app';
@NgModule({
imports: [
IntercomModule.forRoot(YOUR_APP_ID)
]
})
export class AppModule{}
- Use in your components/directives/whatever you want!
...
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
Made by Scott Wyatt and Wilson Hobbs in 2017.