### File

`src/app/checkout/address/services/address.service.ts`

### Constructor

`constructor(fb: FormBuilder)`
Defined in src/app/checkout/address/services/address.service.ts:5

### Methods

initAddressForm
`initAddressForm()`
Defined in src/app/checkout/address/services/address.service.ts:8
Returns: `void`

initEmailForm
`initEmailForm()`
Defined in src/app/checkout/address/services/address.service.ts:22
Returns: `void`

createAddresAttributes
`createAddresAttributes(address: any)`
Defined in src/app/checkout/address/services/address.service.ts:28
Returns: `void`

createGuestAddressAttributes
`createGuestAddressAttributes(address: any, email: any)`
Defined in src/app/checkout/address/services/address.service.ts:37
Returns: `void`

    import { FormBuilder, Validators } from '@angular/forms';
    import { Injectable } from '@angular/core';

    @Injectable()
    export class AddressService {
      constructor(private fb: FormBuilder) {}

      initAddressForm() {
        return this.fb.group({
          'firstname': ['', Validators.required],
          'lastname': ['', Validators.required],
          'address1': ['', Validators.required],
          'address2': ['', Validators.required],
          'city': ['', Validators.required],
          'phone': ['', Validators.required],
          'zipcode': [10001, Validators.required],
          'state_id': [3561, Validators.required],
          'country_id': [232, Validators.required]
        });
      }

      initEmailForm() {
        return this.fb.group({
          'email': ['', Validators.required]
        });
      }

      createAddresAttributes(address) {
        return {
          'order': {
            'bill_address_attributes': address,
            'ship_address_attributes': address
          }
        };
      }

      createGuestAddressAttributes(address, email) {
        return {
          'order': {
            'email': email,
            'bill_address_attributes': address,
            'ship_address_attributes': address
          }
        };
      }

    }

# results matching ""

# No results matching ""