Skip to content

Commit 6891579

Browse files
committed
Default model-value for the form-factory
Resolves: #20
1 parent 9e27442 commit 6891579

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)