"...dynamic-content/git@gitlab.lam.fr:anis/anis-next.git" did not exist on "85d8c9e47bb2c7b47657de5411dc4c04a5916fd6"
Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* This file is part of Anis Client.
*
* @copyright Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { WebpageFamily } from 'src/app/metamodel/models';
@Component({
selector: 'app-webpage-family-form',
templateUrl: 'webpage-family-form.component.html'
})
export class WebpageFamilyFormComponent implements OnInit {
@Input() webpageFamily: WebpageFamily;
@Output() onSubmit: EventEmitter<WebpageFamily> = new EventEmitter();
public form = new FormGroup({
label: new FormControl('', [Validators.required]),
display: new FormControl('', [Validators.required])
});
ngOnInit() {
if (this.webpageFamily) {
this.form.patchValue(this.webpageFamily);
}
}
submit() {
if (this.webpageFamily) {
this.onSubmit.emit({
...this.webpageFamily,
...this.form.value
});
} else {
this.onSubmit.emit(this.form.value);
}
}
}