Skip to content

Commit

Permalink
fix(package): merge default config without overriding the forwarded v…
Browse files Browse the repository at this point in the history
…alues from user #155
  • Loading branch information
AnthonyNahas committed Feb 5, 2019
1 parent 5447e31 commit 46ec424
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/module/ngx-auth-firebase-u-i.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {CommonModule} from '@angular/common';
import {NgModule, ModuleWithProviders, InjectionToken} from '@angular/core';
import {NgModule, ModuleWithProviders, InjectionToken, Inject} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {HttpClientModule} from '@angular/common/http';
import {AuthComponent} from './components/auth/auth.component';
Expand Down Expand Up @@ -99,7 +99,7 @@ export const NgxAuthFirebaseUIConfigToken = new InjectionToken<NgxAuthFirebaseUI
export class NgxAuthFirebaseUIModule {
static forRoot(configFactory: FirebaseAppConfig,
appNameFactory?: () => string,
config: NgxAuthFirebaseUIConfig = defaultAuthFirebaseUIConfig): ModuleWithProviders {
config?: NgxAuthFirebaseUIConfig): ModuleWithProviders {
return {
ngModule: NgxAuthFirebaseUIModule,
providers:
Expand All @@ -122,4 +122,9 @@ export class NgxAuthFirebaseUIModule {
],
};
}

constructor(@Inject(NgxAuthFirebaseUIConfigToken)
public config: NgxAuthFirebaseUIConfig) {
this.config = Object.assign(defaultAuthFirebaseUIConfig, this.config);
}
}

0 comments on commit 46ec424

Please sign in to comment.