Skip to content

Commit

Permalink
Merge pull request #7 from Lemoncode/Sample_03_List_Patient_moving_to…
Browse files Browse the repository at this point in the history
…_angular_services

Moved to services / IOC #5
  • Loading branch information
brauliodiez authored Sep 24, 2016
2 parents 7685d1e + 88239e8 commit 8e918ef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions 03 List Page/src/api/patientAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class PatientAPI {
}
}

const patientAPI = new PatientAPI();

export {
patientAPI
PatientAPI
}
5 changes: 3 additions & 2 deletions 03 List Page/src/components/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';

import {PatientAPI} from '../api/patientAPI';
@Component(
{
selector: 'app',
Expand All @@ -9,7 +9,8 @@ import { Component } from '@angular/core';
<router-outlet></router-outlet>
</div>
`
`,
providers: [PatientAPI]
}
)
class App {
Expand Down
4 changes: 2 additions & 2 deletions 03 List Page/src/components/patients/patientList.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { Patient } from '../../model/patient';
import { Promise } from 'core-js/es6';
import { patientAPI } from '../../api/patientAPI';
import { PatientAPI } from '../../api/patientAPI';

@Component({
selector: 'patient-list',
Expand Down Expand Up @@ -54,7 +54,7 @@ import { patientAPI } from '../../api/patientAPI';
class PatientList {
patients: Array<Patient>;

constructor() {
constructor(patientAPI : PatientAPI) {
patientAPI.getAllPatientsAsync().then((patients: Array<Patient>) => {
this.patients = patients;
});
Expand Down
4 changes: 2 additions & 2 deletions 03 List Page/src/components/patients/searchPatient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { Promise } from 'core-js/es6';
import { patientAPI } from '../../api/patientAPI';
import { PatientAPI } from '../../api/patientAPI';

@Component({
selector: 'search-patient',
Expand Down Expand Up @@ -46,7 +46,7 @@ import { patientAPI } from '../../api/patientAPI';
class SearchPatient {
specialties: Array<string>;

constructor() {
constructor(patientAPI : PatientAPI) {
patientAPI.getAllSpecialtiesAsync().then((specialties: Array<string>) => {
this.specialties = specialties;
});
Expand Down

0 comments on commit 8e918ef

Please sign in to comment.