diff --git a/src/app/address.ts b/src/app/address.ts new file mode 100644 index 0000000..f6936b0 --- /dev/null +++ b/src/app/address.ts @@ -0,0 +1,16 @@ +export class Address { + public lineOne: string; + public city: string; + public country: string; + public zipCode: number; + public state: string; + public lineTwo: string; + + constructor() { + this.lineOne = ''; + this.lineTwo = ''; + this.city = ''; + this.country = ''; + this.zipCode = null; + } +} diff --git a/src/app/api-contact.ts b/src/app/api-contact.ts new file mode 100644 index 0000000..8805cca --- /dev/null +++ b/src/app/api-contact.ts @@ -0,0 +1,22 @@ +import { Contact } from "./contact"; +import { Address } from "./address"; + +export class ApiContact { + + public id: string; + public firstName: string; + public lastName: string; + public address: Address; + public bio: string; + public gender?: string; + public email: string; + public phone?: string; + + + constructor(firstName: string, lastName: string, address: Address) { + this.firstName = firstName; + this.lastName = lastName; + this.address = address; + } + +} diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9a9dc69..8a34aef 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,12 +1,17 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; +import { HttpClientModule } from '@angular/common/http' + +import { ContactService } from './services/contact.service' import { AppComponent } from './app.component'; import { ContactFormComponent } from './components/contact-form/contact-form.component'; import { HeaderComponent } from './components/blocks/header/header.component'; import { ToDosComponent } from './components/blocks/to-dos/to-dos.component'; import { DocComponent } from './components/blocks/doc/doc.component'; +import { ContactAddressComponent } from './components/contact-address/contact-address.component'; +import { ApiContactPipe } from './pipes/api-contact.pipe'; @NgModule({ @@ -15,13 +20,16 @@ import { DocComponent } from './components/blocks/doc/doc.component'; ContactFormComponent, HeaderComponent, ToDosComponent, - DocComponent + DocComponent, + ContactAddressComponent, + ApiContactPipe ], imports: [ BrowserModule, - FormsModule + FormsModule, + HttpClientModule ], - providers: [], + providers: [ContactService, ApiContactPipe], bootstrap: [AppComponent] }) export class AppModule { } diff --git a/src/app/components/contact-address/contact-address.component.css b/src/app/components/contact-address/contact-address.component.css new file mode 100644 index 0000000..e0d207e --- /dev/null +++ b/src/app/components/contact-address/contact-address.component.css @@ -0,0 +1,28 @@ +.ng-valid[required], +.ng-valid.required { + border-left: 5px solid #42A948; + /* green */ +} + +.ng-invalid:not(form) { + border-left: 5px solid #a94442; + /* red */ +} + +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + margin: 0; +} + +fieldset.pretty-set { + border: 1px solid lightgrey; + border-radius: 5px; + padding: 15px; +} + +fieldset.pretty-set > legend { + font-size: 1rem; +} diff --git a/src/app/components/contact-address/contact-address.component.html b/src/app/components/contact-address/contact-address.component.html new file mode 100644 index 0000000..1b16b2f --- /dev/null +++ b/src/app/components/contact-address/contact-address.component.html @@ -0,0 +1,45 @@ +
diff --git a/src/app/components/contact-address/contact-address.component.spec.ts b/src/app/components/contact-address/contact-address.component.spec.ts new file mode 100644 index 0000000..c3518c7 --- /dev/null +++ b/src/app/components/contact-address/contact-address.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ContactAddressComponent } from './contact-address.component'; + +describe('ContactAddressComponent', () => { + let component: ContactAddressComponent; + let fixture: ComponentFixture