Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit 4ce876d

Browse files
author
Kent C. Dodds
committed
fix(ngModelAttrs): Change expression to statement
The term is incorrect. What you're defining is actually a closes #294 BREAKING CHANGE: Anywhere you define if you're using you should change it to .
1 parent d5a1190 commit 4ce876d

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/directives/formly-field.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ describe('formly-field', function() {
184184
attribute: 'required'
185185
},
186186
myChange: {
187-
expression: 'ng-change'
187+
statement: 'ng-change'
188188
}
189189
},
190190
templateOptions: {

src/providers/formlyApiCheck.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ const fieldOptionsApiShape = {
129129
hideExpression: formlyExpression.optional,
130130
ngModelElAttrs: apiCheck.objectOf(apiCheck.string).optional,
131131
ngModelAttrs: apiCheck.objectOf(apiCheck.shape({
132-
expression: apiCheck.shape.ifNot(['value', 'attribute', 'bound', 'boolean'], apiCheck.any).optional,
133-
value: apiCheck.shape.ifNot('expression', apiCheck.any).optional,
134-
attribute: apiCheck.shape.ifNot('expression', apiCheck.any).optional,
135-
bound: apiCheck.shape.ifNot('expression', apiCheck.any).optional,
136-
boolean: apiCheck.shape.ifNot('expression', apiCheck.any).optional
132+
statement: apiCheck.shape.ifNot(['value', 'attribute', 'bound', 'boolean'], apiCheck.any).optional,
133+
value: apiCheck.shape.ifNot('statement', apiCheck.any).optional,
134+
attribute: apiCheck.shape.ifNot('statement', apiCheck.any).optional,
135+
bound: apiCheck.shape.ifNot('statement', apiCheck.any).optional,
136+
boolean: apiCheck.shape.ifNot('statement', apiCheck.any).optional
137137
}).strict).optional,
138138
elementAttributes: apiCheck.objectOf(apiCheck.string).optional,
139139
optionsTypes: apiCheck.typeOrArrayOf(apiCheck.string).optional,

src/run/formlyNgModelAttrsManipulator.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ function addFormlyNgModelAttrsManipulator(formlyConfig, $interpolate, formlyWarn
8585
// I realize this looks backwards, but it's right, trust me...
8686
attrName = val.value;
8787
attrVal = name;
88-
} else if (val.expression && inTo) {
89-
attrName = val.expression;
88+
} else if (val.statement && inTo) {
89+
attrName = val.statement;
9090
if (angular.isString(to[name])) {
9191
attrVal = `$eval(${ref})`;
9292
} else if (angular.isFunction(to[name])) {
@@ -197,7 +197,7 @@ function addFormlyNgModelAttrsManipulator(formlyConfig, $interpolate, formlyWarn
197197
const boundOnly = [];
198198
const bothBooleanAndBound = ['required', 'disabled'];
199199
const bothAttributeAndBound = ['pattern', 'minlength'];
200-
const expressionOnly = ['change', 'keydown', 'keyup', 'keypress', 'click', 'focus', 'blur'];
200+
const statementOnly = ['change', 'keydown', 'keyup', 'keypress', 'click', 'focus', 'blur'];
201201
const attributeOnly = ['placeholder', 'min', 'max', 'tabindex', 'type'];
202202
if (formlyConfig.extras.ngModelAttrsManipulatorPreferUnbound) {
203203
bothAttributeAndBound.push('maxlength');
@@ -217,9 +217,9 @@ function addFormlyNgModelAttrsManipulator(formlyConfig, $interpolate, formlyWarn
217217
ngModelAttributes[item] = {attribute: item, bound: 'ng-' + item};
218218
});
219219

220-
angular.forEach(expressionOnly, item => {
220+
angular.forEach(statementOnly, item => {
221221
const propName = 'on' + item.substr(0, 1).toUpperCase() + item.substr(1);
222-
ngModelAttributes[propName] = {expression: 'ng-' + item};
222+
ngModelAttributes[propName] = {statement: 'ng-' + item};
223223
});
224224

225225
angular.forEach(attributeOnly, item => {

0 commit comments

Comments
 (0)