6
6
* @description
7
7
*
8
8
* ngRequired adds the required {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
9
- * It is most often used for [ @link input `input`} and {@link select `select`} controls, but can also be
9
+ * It is most often used for { @link input `input`} and {@link select `select`} controls, but can also be
10
10
* applied to custom controls.
11
11
*
12
12
* The directive sets the `required` attribute on the element if the Angular expression inside
43
43
* </div>
44
44
* </file>
45
45
* <file name="protractor.js" type="protractor">
46
- * var required = element(by.binding('form.input.$error.required'));
47
- * var model = element(by.binding('model'));
48
- *
49
- * it('should set the required error', function() {
50
- * expect(required.getText()).toContain('true');
51
- *
52
- * element(by.id('input')).sendKeys('123');
53
- * expect(required.getText()).not.toContain('true');
54
- * expect(model.getText()).toContain('123');
55
- * });
46
+ var required = element(by.binding('form.input.$error.required'));
47
+ var model = element(by.binding('model'));
48
+ var input = element(by.id('input'));
49
+
50
+ it('should set the required error', function() {
51
+ expect(required.getText()).toContain('true');
52
+
53
+ input.sendKeys('123');
54
+ expect(required.getText()).not.toContain('true');
55
+ expect(model.getText()).toContain('123');
56
+ });
56
57
* </file>
57
58
* </example>
58
59
*/
@@ -82,14 +83,14 @@ var requiredDirective = function() {
82
83
* @description
83
84
*
84
85
* ngPattern adds the pattern {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
85
- * It is most often used for text-based [ @link input `input`} controls, but can also be applied to custom text-based controls.
86
+ * It is most often used for text-based { @link input `input`} controls, but can also be applied to custom text-based controls.
86
87
*
87
- * The validator sets the `pattern` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
88
- * does not match a RegExp which is obtained by evaluating the Angular expression given in the
89
- * `ngPattern` attribute value:
90
- * * If the expression evaluates to a RegExp object, then this is used directly.
91
- * * If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it
92
- * in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`.
88
+ * The validator sets the `pattern` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
89
+ * does not match a RegExp which is obtained by evaluating the Angular expression given in the
90
+ * `ngPattern` attribute value:
91
+ * * If the expression evaluates to a RegExp object, then this is used directly.
92
+ * * If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it
93
+ * in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`.
93
94
*
94
95
* <div class="alert alert-info">
95
96
* **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
@@ -100,9 +101,16 @@ var requiredDirective = function() {
100
101
* <div class="alert alert-info">
101
102
* **Note:** This directive is also added when the plain `pattern` attribute is used, with two
102
103
* differences:
103
- * 1. `ngPattern` does not set the `pattern` attribute and therefore not HTML5 constraint validation
104
- * is available.
105
- * 2. The `ngPattern` attribute must be an expression, while the `pattern` value must be interpolated
104
+ * <ol>
105
+ * <li>
106
+ * `ngPattern` does not set the `pattern` attribute and therefore HTML5 constraint validation is
107
+ * not available.
108
+ * </li>
109
+ * <li>
110
+ * The `ngPattern` attribute must be an expression, while the `pattern` value must be
111
+ * interpolated.
112
+ * </li>
113
+ * </ol>
106
114
* </div>
107
115
*
108
116
* @example
@@ -128,18 +136,18 @@ var requiredDirective = function() {
128
136
* </div>
129
137
* </file>
130
138
* <file name="protractor.js" type="protractor">
131
- var model = element(by.binding('model'));
132
- var input = element(by.id('input'));
139
+ var model = element(by.binding('model'));
140
+ var input = element(by.id('input'));
133
141
134
- it('should validate the input with the default pattern', function() {
135
- input.sendKeys('aaa');
136
- expect(model.getText()).not.toContain('aaa');
142
+ it('should validate the input with the default pattern', function() {
143
+ input.sendKeys('aaa');
144
+ expect(model.getText()).not.toContain('aaa');
137
145
138
- input.clear().then(function() {
139
- input.sendKeys('123');
140
- expect(model.getText()).toContain('123');
141
- });
142
- });
146
+ input.clear().then(function() {
147
+ input.sendKeys('123');
148
+ expect(model.getText()).toContain('123');
149
+ });
150
+ });
143
151
* </file>
144
152
* </example>
145
153
*/
@@ -181,18 +189,25 @@ var patternDirective = function() {
181
189
* @description
182
190
*
183
191
* ngMaxlength adds the maxlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
184
- * It is most often used for text-based [ @link input `input`} controls, but can also be applied to custom text-based controls.
192
+ * It is most often used for text-based { @link input `input`} controls, but can also be applied to custom text-based controls.
185
193
*
186
- * The validator sets the `maxlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
187
- * is longer than the integer obtained by evaluating the Angular expression given in the
188
- * `ngMaxlength` attribute value.
194
+ * The validator sets the `maxlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
195
+ * is longer than the integer obtained by evaluating the Angular expression given in the
196
+ * `ngMaxlength` attribute value.
189
197
*
190
198
* <div class="alert alert-info">
191
199
* **Note:** This directive is also added when the plain `maxlength` attribute is used, with two
192
200
* differences:
193
- * 1. `ngMaxlength` does not set the `maxlength` attribute and therefore not HTML5 constraint validation
194
- * is available.
195
- * 2. The `ngMaxlength` attribute must be an expression, while the `maxlength` value must be interpolated
201
+ * <ol>
202
+ * <li>
203
+ * `ngMaxlength` does not set the `maxlength` attribute and therefore HTML5 constraint
204
+ * validation is not available.
205
+ * </li>
206
+ * <li>
207
+ * The `ngMaxlength` attribute must be an expression, while the `maxlength` value must be
208
+ * interpolated.
209
+ * </li>
210
+ * </ol>
196
211
* </div>
197
212
*
198
213
* @example
@@ -218,7 +233,7 @@ var patternDirective = function() {
218
233
* </div>
219
234
* </file>
220
235
* <file name="protractor.js" type="protractor">
221
- * var model = element(by.binding('model'));
236
+ var model = element(by.binding('model'));
222
237
var input = element(by.id('input'));
223
238
224
239
it('should validate the input with the default maxlength', function() {
@@ -260,18 +275,25 @@ var maxlengthDirective = function() {
260
275
* @description
261
276
*
262
277
* ngMinlength adds the minlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
263
- * It is most often used for text-based [ @link input `input`} controls, but can also be applied to custom text-based controls.
278
+ * It is most often used for text-based { @link input `input`} controls, but can also be applied to custom text-based controls.
264
279
*
265
- * The validator sets the `minlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
266
- * is shorter than the integer obtained by evaluating the Angular expression given in the
267
- * `ngMinlength` attribute value.
280
+ * The validator sets the `minlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
281
+ * is shorter than the integer obtained by evaluating the Angular expression given in the
282
+ * `ngMinlength` attribute value.
268
283
*
269
284
* <div class="alert alert-info">
270
285
* **Note:** This directive is also added when the plain `minlength` attribute is used, with two
271
286
* differences:
272
- * 1. `ngMinlength` does not set the `minlength` attribute and therefore not HTML5 constraint validation
273
- * is available.
274
- * 2. The `ngMinlength` value must be an expression, while the `minlength` value must be interpolated
287
+ * <ol>
288
+ * <li>
289
+ * `ngMinlength` does not set the `minlength` attribute and therefore HTML5 constraint
290
+ * validation is not available.
291
+ * </li>
292
+ * <li>
293
+ * The `ngMinlength` value must be an expression, while the `minlength` value must be
294
+ * interpolated.
295
+ * </li>
296
+ * </ol>
275
297
* </div>
276
298
*
277
299
* @example
@@ -297,15 +319,16 @@ var maxlengthDirective = function() {
297
319
* </div>
298
320
* </file>
299
321
* <file name="protractor.js" type="protractor">
300
- * var model = element(by.binding('model'));
301
- *
302
- * it('should validate the input with the default minlength', function() {
303
- * element(by.id('input')).sendKeys('ab');
304
- * expect(model.getText()).not.toContain('ab');
305
- *
306
- * element(by.id('input')).sendKeys('abc');
307
- * expect(model.getText()).toContain('abc');
308
- * });
322
+ var model = element(by.binding('model'));
323
+ var input = element(by.id('input'));
324
+
325
+ it('should validate the input with the default minlength', function() {
326
+ input.sendKeys('ab');
327
+ expect(model.getText()).not.toContain('ab');
328
+
329
+ input.sendKeys('abc');
330
+ expect(model.getText()).toContain('abc');
331
+ });
309
332
* </file>
310
333
* </example>
311
334
*/
0 commit comments