-
Success! Horse {{ success }} has been successfully added.
+
Success! Horse {{ success }} has been successfully updated.
-
Add new horse
+
Update horse
diff --git a/frontend/wendys-friends/src/app/component/update-horse/update-horse.component.ts b/frontend/wendys-friends/src/app/component/update-horse/update-horse.component.ts
index 420366a..338d817 100644
--- a/frontend/wendys-friends/src/app/component/update-horse/update-horse.component.ts
+++ b/frontend/wendys-friends/src/app/component/update-horse/update-horse.component.ts
@@ -1,7 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params} from '@angular/router';
import { Horse } from '../../dto/horse';
+import { Owner } from '../../dto/owner';
import { HorseService } from '../../service/horse.service';
+import { OwnerService } from '../../service/owner.service';
@Component({
selector: 'app-update-horse',
@@ -13,9 +15,10 @@ export class UpdateHorseComponent implements OnInit {
success: string;
errorMessage = '';
horse: Horse = new Horse(null, null, null, null, null, null, null, null);
+ owners: Array
;
imageToUpload: File = null;
- constructor(private horseService: HorseService, private route: ActivatedRoute) { }
+ constructor(private horseService: HorseService, private route: ActivatedRoute, private ownerService: OwnerService) { }
ngOnInit(): void {
// Extract id from url
@@ -30,6 +33,16 @@ export class UpdateHorseComponent implements OnInit {
this.defaultServiceErrorHandling(error);
}
);
+
+ // Get all owners and save them
+ this.ownerService.getAllOwners().subscribe(
+ (owners: Array) => {
+ this.owners = owners;
+ },
+ error => {
+ this.owners = null;
+ }
+ );
}
/**