Refactor move ContactFormService into contact library

master
Kevin C. Coram 2019-09-05 22:56:08 -04:00
parent bfda0985eb
commit 57d46442c6
Signed by: kevin
GPG Key ID: 0342351B3D61AD35
6 changed files with 16 additions and 7 deletions

View File

@ -6,7 +6,6 @@ import { NameComponent } from './name/name.component';
import { AddressListComponent } from './address-list/address-list.component'; import { AddressListComponent } from './address-list/address-list.component';
import { AddressComponent } from './address/address.component'; import { AddressComponent } from './address/address.component';
import { ContactModule } from '@nested-forms/contact'; import { ContactModule } from '@nested-forms/contact';
import { ContactFormService } from './services/contact-form.service';
describe('AppComponent', () => { describe('AppComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
@ -14,10 +13,15 @@ describe('AppComponent', () => {
imports: [ imports: [
RouterTestingModule, RouterTestingModule,
ReactiveFormsModule, ReactiveFormsModule,
ContactModule.forRoot() ContactModule.forRoot(),
], ],
declarations: [AppComponent, NameComponent, AddressComponent, AddressListComponent], declarations: [
providers: [ ContactFormService ], AppComponent,
NameComponent,
AddressComponent,
AddressListComponent,
],
providers: [],
}).compileComponents(); }).compileComponents();
})); }));

View File

@ -1,8 +1,11 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms'; import { FormGroup } from '@angular/forms';
import { Contact, ContactService } from '@nested-forms/contact'; import {
Contact,
ContactService,
ContactFormService,
} from '@nested-forms/contact';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { ContactFormService } from './services/contact-form.service';
@Component({ @Component({
selector: 'nested-forms-root', selector: 'nested-forms-root',

View File

@ -1,3 +1,4 @@
export * from './lib/contact-model'; export * from './lib/contact-model';
export * from './lib/contact.service'; export * from './lib/contact.service';
export * from './lib/services/contact-form.service';
export * from './lib/contact.module'; export * from './lib/contact.module';

View File

@ -1,6 +1,7 @@
import { NgModule, Optional, SkipSelf } from '@angular/core'; import { NgModule, Optional, SkipSelf } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { ContactService } from './contact.service'; import { ContactService } from './contact.service';
import { ContactFormService } from './services/contact-form.service';
@NgModule({ @NgModule({
declarations: [], declarations: [],
@ -22,7 +23,7 @@ export class ContactModule {
static forRoot() { static forRoot() {
return { return {
ngModule: ContactModule, ngModule: ContactModule,
providers: [ ContactService ] providers: [ ContactService, ContactFormService ]
} }
} }
} }