diff --git a/WEB/src/app/app.module.ts b/WEB/src/app/app.module.ts index 1098759..dbbc69e 100644 --- a/WEB/src/app/app.module.ts +++ b/WEB/src/app/app.module.ts @@ -1,6 +1,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NgModule } from '@angular/core'; +import { ReactiveFormsModule } from '@angular/forms'; import { ODataModule } from 'odata-v4-ng'; import { AppRoutingModule } from './app-routing.module'; @@ -22,6 +23,7 @@ import { SongComponent } from './components/songs/song/song.component'; imports: [ BrowserModule, BrowserAnimationsModule, + ReactiveFormsModule, AppRoutingModule, HttpClientModule, ODataModule, diff --git a/WEB/src/app/components/songs/table/table.component.less b/WEB/src/app/components/songs/table/table.component.less index 06a8d08..ffe8e48 100644 --- a/WEB/src/app/components/songs/table/table.component.less +++ b/WEB/src/app/components/songs/table/table.component.less @@ -1,7 +1,7 @@ table { width: 100%; border-radius: 8px; - //background: #fffe; + background: #fffe; } diff --git a/WEB/src/app/data/edit-song.service.ts b/WEB/src/app/data/edit-song.service.ts new file mode 100644 index 0000000..eaa43cd --- /dev/null +++ b/WEB/src/app/data/edit-song.service.ts @@ -0,0 +1,26 @@ +import { Song } from 'src/app/models/song.model'; +import { SongsService } from 'src/app/data/songs.service'; +import { Injectable } from '@angular/core'; +import { FormGroup, FormControl, Validators } from '@angular/forms'; + +@Injectable({ + providedIn: 'root' +}) +export class EditSongService { + + constructor(private songService: SongsService) { } + + public initEditForm(song: Song): FormGroup { + const form = new FormGroup({ + ID: new FormControl(song.ID), + Number: new FormControl(song.Number), + Name: new FormControl(song.Name, Validators.required), + Text: new FormControl(song.Text), + SongType: new FormControl(song.SongType, Validators.required), + Key: new FormControl(song.Key), + Tempo: new FormControl(song.Tempo) + }); + + return form; + } +}