nested-forms/libs/contact/src/lib/contact.service.ts

40 lines
700 B
TypeScript

import { Injectable } from '@angular/core';
import { Contact } from './contact-model';
import { Observable, of } from 'rxjs';
const contact: Contact = {
name: {
firstName: 'John',
lastName: 'Public',
middleName: 'Q',
prefix: 'Mr',
suffix: 'III',
},
addresses: [
{
line_1: '123 Main Street',
city: 'New York',
state: 'NY',
postalCode: '12345',
},
{
line_1: '123 South Street',
city: 'Boston',
state: 'MA',
postalCode: '54321',
},
],
};
@Injectable({
providedIn: 'root'
})
export class ContactService {
constructor() { }
public loadContact(): Observable<Contact> {
return of({...contact});
}
}