@@ -316,7 +316,8 @@ code-example(language="html" escape="html" format="linenums").
316
316
already furnished with id's.
317
317
318
318
As alternative you can also use the `explicit labelling` syntax. For this syntax you are required to add an `id` to
319
- the `HTML` form element to connect the label up.
319
+ the `HTML` form element to connect the label up via a `for / id` pairing [The `for` attribute of the label has to
320
+ contain the `id` of the input being labelled].
320
321
321
322
This is also the reason why `implicit labelling` could come in very useful with reusable Angular 2 components.
322
323
Remember that an `id` should be unique on a page, and any component where `explicit labelling` is used, will need
@@ -328,6 +329,28 @@ code-example(language="html" escape="html" format="linenums").
328
329
**NOTE:** In the example code we are generating `GUID's` for id's to ensure that they are unique. You can use your
329
330
own method to do this, as long as every page id is unique.
330
331
332
+ Your component template:
333
+
334
+ + makeExample('cb-a11y/ts/app/form-controls/a11y-input-explicit.component.html' )
335
+
336
+ :marked
337
+ Used as:
338
+
339
+ + makeExample('cb-a11y/ts/app/form-controls/a11y-form-controls.component.html' ,'cb-a11y-form-controls-input-explicit-usage' )
340
+
341
+ :marked
342
+ Which is then rendered as:
343
+
344
+ code-example( language ="html" escape ="html" format ="linenums" ) .
345
+ <a11y-input-explicit >
346
+ <div class =" form-group" >
347
+ <label for =" c90c7f99-330e-4723-bfa8-9ab72a4bd435" >
348
+ Label for input:
349
+ </label >
350
+ < input class="form-control"
351
+ id="c90c7f99-330e-4723-bfa8-9ab72a4bd435">
352
+ </div >
353
+ </a11y-input-explicit >
331
354
332
355
333
356
.l-main-section
0 commit comments