Skip to content

Commit 051cafe

Browse files
authored
Merge pull request #21 from T-Systems-MMS/form_control_factory_with_default_value
Default model-value for the form-factory FYI: @malaupa
2 parents 9e27442 + 6891579 commit 051cafe

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/mustache/modelGenericValidators.mustache

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,21 @@
3535
* The FormControlFactory for {{classname}}.
3636
*/
3737
export class FormControlFactory extends BaseFormControlFactory<{{classname}}> {
38-
constructor(model: {{classname}}) {
38+
39+
/**
40+
* Constructor.
41+
*
42+
* @param model An existing model for {{classname}}.
43+
* If given, all form-controls of the factory automatically have the value of this model. If this
44+
* model is not given, all values are `null`.
45+
*/
46+
constructor(
47+
model: {{classname}} = {
48+
{{#vars}}
49+
{{name}}: null,
50+
{{/vars}}
51+
}
52+
) {
3953
super(model, {{classname}}.ModelValidators);
4054
}
4155
}

0 commit comments

Comments
 (0)