|
|
@@ -2,6 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
|
|
|
import { Router } from '@angular/router';
|
|
|
import { TracksApiService } from 'src/app/tracks-api.service';
|
|
|
import { Track } from '../track';
|
|
|
+import { NgForm } from '@angular/forms';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-track-edit',
|
|
|
@@ -25,7 +26,11 @@ export class TrackEditComponent implements OnInit {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- public updateTrack(event: SubmitEvent): void {
|
|
|
+ public updateTrack(form: NgForm, event: SubmitEvent): void {
|
|
|
+ if (!form.valid) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (this.track) {
|
|
|
this.tracksApi.updateTrack(this.track).then(result => {
|
|
|
this.track = result;
|