Skip to content

Commit

Permalink
feat(binding): add people interface
Browse files Browse the repository at this point in the history
  • Loading branch information
nlm-pro committed Nov 26, 2018
1 parent c0c166f commit 0cc9445
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 3 deletions.
4 changes: 3 additions & 1 deletion steps/binding-solution/src/app/_static/people.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const PEOPLE = [
import { People } from '../people.model';

export const PEOPLE: People[] = [
{
id: '5763cd4d9d2a4f259b53c901',
photo: 'https://randomuser.me/portraits/women/59.jpg',
Expand Down
3 changes: 2 additions & 1 deletion steps/binding-solution/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Component, OnInit } from '@angular/core';
import { PEOPLE } from '../_static/people';
import { People } from '../../../../binding/src/app/people.model';

@Component({
selector: 'sfeir-home',
templateUrl: 'home.component.html',
styleUrls: ['home.component.css']
})
export class HomeComponent implements OnInit {
private person: any;
person: People;

constructor() {
this.person = PEOPLE[0];
Expand Down
35 changes: 35 additions & 0 deletions steps/binding-solution/src/app/people.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
interface foo {
bar: number;
}

export class People implements foo {
id: string;
photo: string;
firstname: string;
lastname: string;
entity: string;
entryDate: string;
birthDate: string;
gender: string;
email: string;
skills: string[];
geo: {
lat: number;
lng: number;
};
phone: string;
address: {
street: string;
postalCode: number;
city: string;
};
links: {
twitter: string;
slack: string;
github: string;
linkedin: string;
};
isManager: boolean;
manager: string;
managerId: string;
}
4 changes: 3 additions & 1 deletion steps/binding/src/app/_static/people.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const PEOPLE = [
import { People } from '../people.model';

export const PEOPLE: People[] = [
{
id: '5763cd4d9d2a4f259b53c901',
photo: 'https://randomuser.me/portraits/women/59.jpg',
Expand Down
2 changes: 2 additions & 0 deletions steps/binding/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { People } from '../people.model';

@Component({
selector: 'sfeir-home',
Expand All @@ -7,6 +8,7 @@ import { Component, OnInit } from '@angular/core';
})
export class HomeComponent implements OnInit {
name: string;
people: People;

constructor() {
this.name = 'Angular';
Expand Down
31 changes: 31 additions & 0 deletions steps/binding/src/app/people.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export interface People {
id: string;
photo: string;
firstname: string;
lastname: string;
entity: string;
entryDate: string;
birthDate: string;
gender: string;
email: string;
skills: string[];
geo: {
lat: number;
lng: number;
};
phone: string;
address: {
street: string;
postalCode: number;
city: string;
};
links: {
twitter: string;
slack: string;
github: string;
linkedin: string;
};
isManager: boolean;
manager: string;
managerId: string;
}

0 comments on commit 0cc9445

Please sign in to comment.