Skip to content

Commit dd167ae

Browse files
author
Kent C. Dodds
committed
Fixing issue with errorExistsAndShouldBeVisible and adding a shortcut
1 parent c5ba668 commit dd167ae

File tree

8 files changed

+21
-13
lines changed

8 files changed

+21
-13
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 3.2.6
2+
3+
## Bug Fixes & New Features
4+
5+
- Introducing `showError` as a scope variable in `formly-field`s. It's a shortcut for `options.validation.errorExistsAndShouldBeVisible`. Also, fixing an issue where a non-boolean value for `validation.show` would be used. Also, `validation.show` will only set these to `true` if the form control is also `$invalid` which was the original intent.
6+
17
# 3.2.5
28

39
## Bug Fixes

bower.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": "3.2.5",
3+
"version": "3.2.6",
44
"authors": [
55
"Astrism <[email protected]>"
66
],

demo/bundle.js

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

dist/formly.js

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

dist/formly.min.js

Lines changed: 2 additions & 2 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": "3.2.5",
3+
"version": "3.2.6",
44
"author": "Astrism <[email protected]>",
55
"contributors": [
66
"Astrism <[email protected]>",

src/directives/formly-field.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,14 @@ module.exports = ngModule => {
145145

146146
function addShowMessagesWatcher(scope, options) {
147147
scope.$watch(function() {
148-
if (angular.isDefined(scope.options.validation.show)) {
149-
return scope.options.validation.show;
148+
if (angular.isBoolean(scope.options.validation.show)) {
149+
return scope.fc.$invalid && scope.options.validation.show;
150150
} else {
151151
return scope.fc.$invalid && scope.fc.$touched;
152152
}
153153
}, function(show) {
154154
options.validation.errorExistsAndShouldBeVisible = show;
155+
scope.showError = show;
155156
});
156157
}
157158

0 commit comments

Comments
 (0)