Skip to content

Commit

Permalink
fix(#551): ensure templateOptions is defined (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
aitboudad authored Nov 7, 2017
1 parent 23b4b13 commit 48f4a36
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/src/services/formly.form.builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('FormlyFormBuilder service', () => {
field = { key: 'title' };
builder.buildForm(form, [field], {}, {});

expect(field.templateOptions).toEqual(undefined);
expect(field.templateOptions).toEqual({});
});

it('should set the default value if the specified key and type is defined', () => {
Expand Down
1 change: 1 addition & 0 deletions src/core/src/services/formly.form.builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export class FormlyFormBuilder {
}

private initFieldTemplateOptions(field: FormlyFieldConfig) {
field.templateOptions = field.templateOptions || {};
if (field.key && field.type) {
field.templateOptions = Object.assign({
label: '',
Expand Down

0 comments on commit 48f4a36

Please sign in to comment.