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

Commit 1527c15

Browse files
committed
v7.1.2
2 parents 5702a31 + 0939bb1 commit 1527c15

File tree

6 files changed

+32
-11
lines changed

6 files changed

+32
-11
lines changed

dist/formly.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! angular-formly version 7.1.1 built with ♥ by Astrism <[email protected]>, Kent C. Dodds <[email protected]> (ó ì_í)=óò=(ì_í ò)
1+
//! angular-formly version 7.1.2 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', ("7.1.1")); // <-- webpack variable
150+
ngModule.constant('formlyVersion', ("7.1.2")); // <-- webpack variable
151151

152152
ngModule.provider('formlyUsability', _providersFormlyUsability2['default']);
153153
ngModule.provider('formlyConfig', _providersFormlyConfig2['default']);
@@ -416,7 +416,7 @@ return /******/ (function(modules) { // webpackBootstrap
416416
Object.defineProperty(exports, "__esModule", {
417417
value: true
418418
});
419-
exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("7.1.1") + "/other/ERRORS_AND_WARNINGS.md#";
419+
exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("7.1.2") + "/other/ERRORS_AND_WARNINGS.md#";
420420
module.exports = exports["default"];
421421

422422
/***/ },
@@ -1287,7 +1287,8 @@ return /******/ (function(modules) { // webpackBootstrap
12871287

12881288
function setDefaultValue() {
12891289
if (_angularFix2['default'].isDefined($scope.options.defaultValue) && !_angularFix2['default'].isDefined($scope.model[$scope.options.key])) {
1290-
$scope.model[$scope.options.key] = $scope.options.defaultValue;
1290+
var setter = $parse($scope.options.key).assign;
1291+
setter($scope.model, $scope.options.defaultValue);
12911292
}
12921293
}
12931294

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": "7.1.1",
3+
"version": "7.1.2",
44
"author": "Astrism <[email protected]>",
55
"contributors": [
66
"Astrism <[email protected]>",

src/directives/formly-field.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ function formlyField($http, $q, $compile, $templateCache, $interpolate, formlyCo
110110

111111
function setDefaultValue() {
112112
if (angular.isDefined($scope.options.defaultValue) && !angular.isDefined($scope.model[$scope.options.key])) {
113-
$scope.model[$scope.options.key] = $scope.options.defaultValue;
113+
const setter = $parse($scope.options.key).assign;
114+
setter($scope.model, $scope.options.defaultValue);
114115
}
115116
}
116117

src/directives/formly-field.test.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,9 @@ describe('formly-field', function() {
449449
});
450450

451451
describe(`defaultValue`, () => {
452-
const key = '♪┏(・o・)┛♪┗ ( ・o・) ┓♪';
452+
const key = 'foo';
453453
const defaultValue = '~=[,,_,,]:3';
454+
454455
beforeEach(() => {
455456
scope.fields = [
456457
{template: input, key, defaultValue}
@@ -498,6 +499,24 @@ describe('formly-field', function() {
498499

499500
expect(scope.fields[0].initialValue).to.eq(defaultValue);
500501
});
502+
503+
describe(`nested keys`, () => {
504+
const nestedObject = 'foo.bar';
505+
const nestedArray = 'baz[0]';
506+
beforeEach(() => {
507+
const firstField = scope.fields[0];
508+
firstField.key = nestedObject;
509+
510+
const secondField = {template: input, key: nestedArray, defaultValue};
511+
scope.fields.push(secondField);
512+
});
513+
514+
it(`should set the default value for nested keys`, () => {
515+
compileAndDigest();
516+
expect(scope.model.foo.bar).to.equal(defaultValue);
517+
expect(scope.model.baz[0]).to.equal(defaultValue);
518+
});
519+
});
501520
});
502521

503522
describe(`id property`, () => {

0 commit comments

Comments
 (0)