Skip to content

Commit 12c59fd

Browse files
committed
Proper error messages
Depends on latest development branch of angular schema form. Angular material wants ng-message(s) directives, at least its CSS does, so we add them but don't really use the for the actual message. A bit of a hack.
1 parent 9f800c8 commit 12c59fd

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/default.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
name="{{form.key.slice(-1)[0]}}"
1919
aria-describedby="{{form.key.slice(-1)[0] + 'Status'}}">
2020
-->
21+
2122
<input ng-model="$$value$$"
2223
ng-show="form.key"
2324
type="{{form.type}}"
@@ -29,6 +30,11 @@
2930
ng-disabled="form.readonly"
3031
name="{{form.key.slice(-1)[0]}}"
3132
schema-validate="form">
32-
33-
<div sf-message="form.description"></div>
33+
<div ng-messages="ngModel.$error">
34+
<!--
35+
This is a bit of a hack. sf-message does the work, but ng-messages and ng-message
36+
is needed for the styling
37+
-->
38+
<div sf-message ng-message></div>
39+
</div>
3440
</md-input-container>

src/textarea.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,11 @@
99
schema-validate="form"
1010
name="{{form.key.slice(-1)[0]}}"></textarea>
1111

12-
<span class="help-block" sf-message="form.description"></span>
12+
<div ng-messages="ngModel.$error">
13+
<!--
14+
This is a bit of a hack. sf-message does the work, but ng-messages and ng-message
15+
is needed for the styling
16+
-->
17+
<div sf-message ng-message></div>
18+
</div>
1319
</md-input-container>

0 commit comments

Comments
 (0)