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] > (ó ì_í)=óò=(ì_í ò)
2
2
3
3
( function webpackUniversalModuleDefinition ( root , factory ) {
4
4
if ( typeof exports === 'object' && typeof module === 'object' )
@@ -147,7 +147,7 @@ return /******/ (function(modules) { // webpackBootstrap
147
147
148
148
ngModule . constant ( 'formlyApiCheck' , _providersFormlyApiCheck2 [ 'default' ] ) ;
149
149
ngModule . constant ( 'formlyErrorAndWarningsUrlPrefix' , _otherDocsBaseUrl2 [ 'default' ] ) ;
150
- ngModule . constant ( 'formlyVersion' , ( "6.23.6 " ) ) ; // <-- webpack variable
150
+ ngModule . constant ( 'formlyVersion' , ( "6.23.7 " ) ) ; // <-- webpack variable
151
151
152
152
ngModule . provider ( 'formlyUsability' , _providersFormlyUsability2 [ 'default' ] ) ;
153
153
ngModule . provider ( 'formlyConfig' , _providersFormlyConfig2 [ 'default' ] ) ;
@@ -449,7 +449,7 @@ return /******/ (function(modules) { // webpackBootstrap
449
449
Object . defineProperty ( exports , "__esModule" , {
450
450
value : true
451
451
} ) ;
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#" ;
453
453
module . exports = exports [ "default" ] ;
454
454
455
455
/***/ } ,
@@ -904,7 +904,7 @@ return /******/ (function(modules) { // webpackBootstrap
904
904
905
905
var _angularFix2 = _interopRequireDefault ( _angularFix ) ;
906
906
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 } ;
908
908
909
909
function formlyEval ( scope , expression , $modelValue , $viewValue , extraLocals ) {
910
910
if ( _angularFix2 [ 'default' ] . isFunction ( expression ) ) {
@@ -1008,6 +1008,14 @@ return /******/ (function(modules) { // webpackBootstrap
1008
1008
return primary ;
1009
1009
}
1010
1010
}
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
+ }
1011
1019
module . exports = exports [ 'default' ] ;
1012
1020
1013
1021
/***/ } ,
@@ -2170,10 +2178,15 @@ return /******/ (function(modules) { // webpackBootstrap
2170
2178
// a set of field models that are already watched (the $scope.model will have its own watcher)
2171
2179
var watchedModels = [ $scope . model ] ;
2172
2180
2181
+ if ( $scope . options . formState ) {
2182
+ // $scope.options.formState will have its own watcher
2183
+ watchedModels . push ( $scope . options . formState ) ;
2184
+ }
2185
+
2173
2186
_angularFix2 [ 'default' ] . forEach ( $scope . fields , function ( field ) {
2174
- initModel ( field ) ;
2187
+ var isNewModel = initModel ( field ) ;
2175
2188
2176
- if ( field . model && watchedModels . indexOf ( field . model ) === - 1 ) {
2189
+ if ( field . model && isNewModel && watchedModels . indexOf ( field . model ) === - 1 ) {
2177
2190
$scope . $watch ( function ( ) {
2178
2191
return field . model ;
2179
2192
} , onModelOrFormStateChange , true ) ;
@@ -2183,14 +2196,22 @@ return /******/ (function(modules) { // webpackBootstrap
2183
2196
}
2184
2197
2185
2198
function initModel ( field ) {
2199
+ var isNewModel = true ;
2200
+
2186
2201
if ( _angularFix2 [ 'default' ] . isString ( field . model ) ) {
2187
2202
var expression = field . model ;
2188
2203
var index = $scope . fields . indexOf ( field ) ;
2204
+
2205
+ if ( formlyUtil . startsWith ( expression , 'model.' ) || formlyUtil . startsWith ( expression , 'formState.' ) ) {
2206
+ isNewModel = false ;
2207
+ }
2208
+
2189
2209
field . model = evalCloseToFormlyExpression ( expression , undefined , field , index ) ;
2190
2210
if ( ! field . model ) {
2191
2211
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 ) ;
2192
2212
}
2193
2213
}
2214
+ return isNewModel ;
2194
2215
}
2195
2216
2196
2217
function attachKey ( field , index ) {
0 commit comments