@@ -19,14 +19,28 @@ part of angular.directive;
19
19
*
20
20
* index.html:
21
21
*
22
- * <p ng-class="{strike: strike, bold: bold, red: red}">Map Syntax Example</p>
22
+ * <!--
23
+ * The map syntax:
24
+ *
25
+ * ng-class="{key1: value1, key2: value2, ...}"
26
+ *
27
+ * results in only adding CSS classes represented by the map keys when
28
+ * the corresponding value expressions are truthy.
29
+ *
30
+ * To use a css class that contains a hyphen (such as line-through in this
31
+ * example), you should quote the name to make it a valid map key. You
32
+ * may, of course, quote all the map keys for consistency.
33
+ * -->
34
+ * <p ng-class="{'line-through': strike, bold: bold, red: red}">Map Syntax Example</p>
23
35
* <input type="checkbox" ng-model="bold"> bold
24
36
* <input type="checkbox" ng-model="strike"> strike
25
37
* <input type="checkbox" ng-model="red"> red
26
38
* <hr>
39
+ *
27
40
* <p ng-class="style">Using String Syntax</p>
28
41
* <input type="text" ng-model="style" placeholder="Type: bold strike red">
29
42
* <hr>
43
+ *
30
44
* <p ng-class="[style1, style2, style3]">Using Array Syntax</p>
31
45
* <input ng-model="style1" placeholder="Type: bold"><br>
32
46
* <input ng-model="style2" placeholder="Type: strike"><br>
@@ -37,6 +51,9 @@ part of angular.directive;
37
51
* .strike {
38
52
* text-decoration: line-through;
39
53
* }
54
+ * .line-through {
55
+ * text-decoration: line-through;
56
+ * }
40
57
* .bold {
41
58
* font-weight: bold;
42
59
* }
0 commit comments