Skip to content

Commit 83329c3

Browse files
committed
gulped
1 parent e7ff94b commit 83329c3

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

dist/schema-form.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,16 +2016,24 @@ angular.module('schemaForm').directive('sfMessage',
20162016
var $sanitize = $injector.has('$sanitize') ?
20172017
$injector.get('$sanitize') : function(html) { return html; };
20182018

2019-
//Prepare and sanitize message, i.e. description in most cases.
2020-
var msg = '';
2019+
var message = '';
2020+
20212021
if (attrs.sfMessage) {
2022-
msg = scope.$eval(attrs.sfMessage) || '';
2023-
msg = $sanitize(msg);
2022+
scope.$watch(attrs.sfMessage, function(msg) {
2023+
if (msg) {
2024+
message = $sanitize(msg);
2025+
if (scope.ngModel) {
2026+
update(scope.ngModel.$valid);
2027+
} else {
2028+
update();
2029+
}
2030+
}
2031+
});
20242032
}
20252033

20262034
var update = function(valid) {
20272035
if (valid && !scope.hasError()) {
2028-
element.html(msg);
2036+
element.html(message);
20292037
} else {
20302038

20312039

@@ -2055,7 +2063,7 @@ angular.module('schemaForm').directive('sfMessage',
20552063
scope.options && scope.options.validationMessage
20562064
));
20572065
} else {
2058-
element.html(msg);
2066+
element.html(message);
20592067
}
20602068
}
20612069
};

0 commit comments

Comments
 (0)