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

Commit 2ee6191

Browse files
author
Kent C. Dodds
committed
6.23.7
1 parent 7689387 commit 2ee6191

File tree

5 files changed

+38
-11
lines changed

5 files changed

+38
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 6.23.7
2+
3+
## Perf
4+
5+
- [@redhead](https://github.com/redhead) optomized the use of `formState` and `model` for the `model` property. Thanks!
6+
17
# 6.23.5
28

39
## Bug Fixes

dist/formly.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! angular-formly version 6.23.6 built with ♥ by Astrism <[email protected]>, Kent C. Dodds <[email protected]> (ó ì_í)=óò=(ì_í ò)
1+
//! angular-formly version 6.23.7 built with ♥ by Astrism <[email protected]>, Kent C. Dodds <[email protected]> (ó ì_í)=óò=(ì_í ò)
22

33
(function webpackUniversalModuleDefinition(root, factory) {
44
if(typeof exports === 'object' && typeof module === 'object')
@@ -147,7 +147,7 @@ return /******/ (function(modules) { // webpackBootstrap
147147

148148
ngModule.constant('formlyApiCheck', _providersFormlyApiCheck2['default']);
149149
ngModule.constant('formlyErrorAndWarningsUrlPrefix', _otherDocsBaseUrl2['default']);
150-
ngModule.constant('formlyVersion', ("6.23.6")); // <-- webpack variable
150+
ngModule.constant('formlyVersion', ("6.23.7")); // <-- webpack variable
151151

152152
ngModule.provider('formlyUsability', _providersFormlyUsability2['default']);
153153
ngModule.provider('formlyConfig', _providersFormlyConfig2['default']);
@@ -449,7 +449,7 @@ return /******/ (function(modules) { // webpackBootstrap
449449
Object.defineProperty(exports, "__esModule", {
450450
value: true
451451
});
452-
exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("6.23.6") + "/other/ERRORS_AND_WARNINGS.md#";
452+
exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("6.23.7") + "/other/ERRORS_AND_WARNINGS.md#";
453453
module.exports = exports["default"];
454454

455455
/***/ },
@@ -904,7 +904,7 @@ return /******/ (function(modules) { // webpackBootstrap
904904

905905
var _angularFix2 = _interopRequireDefault(_angularFix);
906906

907-
exports['default'] = { formlyEval: formlyEval, getFieldId: getFieldId, reverseDeepMerge: reverseDeepMerge, findByNodeName: findByNodeName, arrayify: arrayify, extendFunction: extendFunction, extendArray: extendArray };
907+
exports['default'] = { formlyEval: formlyEval, getFieldId: getFieldId, reverseDeepMerge: reverseDeepMerge, findByNodeName: findByNodeName, arrayify: arrayify, extendFunction: extendFunction, extendArray: extendArray, startsWith: startsWith };
908908

909909
function formlyEval(scope, expression, $modelValue, $viewValue, extraLocals) {
910910
if (_angularFix2['default'].isFunction(expression)) {
@@ -1008,6 +1008,14 @@ return /******/ (function(modules) { // webpackBootstrap
10081008
return primary;
10091009
}
10101010
}
1011+
1012+
function startsWith(str, search) {
1013+
if (_angularFix2['default'].isString(str) && _angularFix2['default'].isString(search)) {
1014+
return str.length >= search.length && str.substring(0, search.length) === search;
1015+
} else {
1016+
return false;
1017+
}
1018+
}
10111019
module.exports = exports['default'];
10121020

10131021
/***/ },
@@ -2170,10 +2178,15 @@ return /******/ (function(modules) { // webpackBootstrap
21702178
// a set of field models that are already watched (the $scope.model will have its own watcher)
21712179
var watchedModels = [$scope.model];
21722180

2181+
if ($scope.options.formState) {
2182+
// $scope.options.formState will have its own watcher
2183+
watchedModels.push($scope.options.formState);
2184+
}
2185+
21732186
_angularFix2['default'].forEach($scope.fields, function (field) {
2174-
initModel(field);
2187+
var isNewModel = initModel(field);
21752188

2176-
if (field.model && watchedModels.indexOf(field.model) === -1) {
2189+
if (field.model && isNewModel && watchedModels.indexOf(field.model) === -1) {
21772190
$scope.$watch(function () {
21782191
return field.model;
21792192
}, onModelOrFormStateChange, true);
@@ -2183,14 +2196,22 @@ return /******/ (function(modules) { // webpackBootstrap
21832196
}
21842197

21852198
function initModel(field) {
2199+
var isNewModel = true;
2200+
21862201
if (_angularFix2['default'].isString(field.model)) {
21872202
var expression = field.model;
21882203
var index = $scope.fields.indexOf(field);
2204+
2205+
if (formlyUtil.startsWith(expression, 'model.') || formlyUtil.startsWith(expression, 'formState.')) {
2206+
isNewModel = false;
2207+
}
2208+
21892209
field.model = evalCloseToFormlyExpression(expression, undefined, field, index);
21902210
if (!field.model) {
21912211
throw formlyUsability.getFieldError('field-model-must-be-initialized', 'Field model must be initialized. When specifying a model as a string for a field, the result of the' + ' expression must have been initialized ahead of time.', field);
21922212
}
21932213
}
2214+
return isNewModel;
21942215
}
21952216

21962217
function attachKey(field, index) {

dist/formly.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/formly.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-formly",
3-
"version": "6.23.6",
3+
"version": "6.23.7",
44
"author": "Astrism <[email protected]>",
55
"contributors": [
66
"Astrism <[email protected]>",

0 commit comments

Comments
 (0)