ng-intercom
Advanced tools
Comparing version
{ | ||
"name": "ng-intercom", | ||
"version": "1.0.0-alpha.4", | ||
"version": "1.0.0-alpha.5", | ||
"description": "An Intercom wrapper for Angular", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index", |
import { CommonModule } from '@angular/common'; | ||
import { ModuleWithProviders, NgModule } from '@angular/core'; | ||
import { InjectionToken, ModuleWithProviders, NgModule } from '@angular/core'; | ||
import { IntercomHideDirective } from './directives/hide.directive'; | ||
@@ -13,5 +13,3 @@ import { IntercomShowMessagesDirective } from './directives/show-messages.directive'; | ||
export function getIntercomService(config: IntercomConfig) { | ||
return new Intercom(config); | ||
} | ||
export const CONFIG = new InjectionToken('CONFIG'); | ||
@@ -43,7 +41,4 @@ @NgModule({ | ||
providers: [ | ||
{ | ||
provide: Intercom, | ||
useFactory: getIntercomService, | ||
deps: [config] | ||
} | ||
Intercom, | ||
{ provide: CONFIG, useValue: config } | ||
] | ||
@@ -50,0 +45,0 @@ } |
@@ -1,2 +0,3 @@ | ||
import { Injectable, Optional } from '@angular/core'; | ||
import { Injectable, Inject } from '@angular/core'; | ||
import { CONFIG } from '../intercom.module'; | ||
import { IntercomConfig } from '../types/intercom-config'; | ||
@@ -13,3 +14,3 @@ import { loadIntercom } from '../util/load-intercom'; | ||
constructor( | ||
@Optional() private config: IntercomConfig | ||
@Inject(CONFIG) private config: IntercomConfig | ||
) { | ||
@@ -16,0 +17,0 @@ console.log(config); |
76830
-0.08%1124
-0.35%