import { Component, OnInit } from '@angular/core';
import { ThemequestionService } from '../themequestion.service';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Router } from '@angular/router';
@Component({
selector: 'themequestioncreate',
templateUrl: './create.component.html',
styleUrls: ['./create.component.css']
})
export class CreateComponent implements OnInit {
themequestionForm: FormGroup;
ngOnInit() {
this.themequestionForm = this.fb.group({
CodeThemeQuestion: [''],
NomThemeQuestion: [''],
DescriptionThemeQuestion: [''],
})
}
constructor(
public fb: FormBuilder,
private router: Router,
public themequestionService: ThemequestionService
){ }
submitForm() {
this.themequestionService.create(this.themequestionForm.value).subscribe(res => {
console.log('Thème question créé!')
this.router.navigateByUrl('/backoffice/themequestion/')
})
}
}