Skip to content

Commit

Permalink
fix(core): disabled expression should not overwrites child expr… (#2130)
Browse files Browse the repository at this point in the history
fix #2129, fix #2128
  • Loading branch information
aitboudad committed Mar 6, 2020
1 parent 2129892 commit f779edb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ describe('FieldExpressionExtension', () => {
{
key: 'street',
type: 'input',
expressionProperties: { 'templateOptions.label': () => 'Street' },
},
],
}];
Expand All @@ -388,6 +389,7 @@ describe('FieldExpressionExtension', () => {
expect(fields[0].templateOptions.disabled).toBeTruthy();
expect(fields[0].fieldGroup[0].templateOptions.disabled).toBeTruthy();
expect(fields[0].fieldGroup[1].templateOptions.disabled).toBeTruthy();
expect(fields[0].fieldGroup[1].templateOptions.label).toEqual('Street');

disabled.address = false;
options._checkField({ formControl: form, fieldGroup: fields, model, options });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class FieldExpressionExtension implements FormlyExtension {
field._expressionProperties[key] = {
expression: this._evalExpression(
expressionProperty,
field.parent.expressionProperties && field.parent.expressionProperties.hasOwnProperty('templateOptions.disabled')
key === 'templateOptions.disabled' && field.parent.expressionProperties && field.parent.expressionProperties.hasOwnProperty('templateOptions.disabled')
? () => field.parent.templateOptions.disabled
: undefined,
),
Expand Down

0 comments on commit f779edb

Please sign in to comment.