edit song form
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
import { ReactiveFormsModule } from '@angular/forms';
|
||||||
import { ODataModule } from 'odata-v4-ng';
|
import { ODataModule } from 'odata-v4-ng';
|
||||||
|
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
@@ -22,6 +23,7 @@ import { SongComponent } from './components/songs/song/song.component';
|
|||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
ODataModule,
|
ODataModule,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
table {
|
table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
//background: #fffe;
|
background: #fffe;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
WEB/src/app/data/edit-song.service.ts
Normal file
26
WEB/src/app/data/edit-song.service.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user