Skip to content

Commit 71712a2

Browse files
committed
Update messages when we got a form
The order in which things happen is different when using the new builder.
1 parent b25b09b commit 71712a2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/directives/message.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ angular.module('schemaForm').directive('sfMessage',
4747
// We only show one error.
4848
// TODO: Make that optional
4949
var error = errors[0];
50+
5051
if (error) {
5152
element.html(sfErrorMessage.interpolate(
5253
error,
@@ -60,7 +61,15 @@ angular.module('schemaForm').directive('sfMessage',
6061
}
6162
}
6263
};
63-
update();
64+
65+
// When link occurs we might not have form with the new builder.
66+
var once = scope.$watch('form', function(form) {
67+
if (form) {
68+
update();
69+
once();
70+
}
71+
});
72+
6473

6574
scope.$watchCollection('ngModel.$error', function() {
6675
if (scope.ngModel) {

0 commit comments

Comments
 (0)