<div ng-app>
<p ng-class="{strike: deleted, bold: important, red: error}">Map Syntax Example</p>
<label><input type="checkbox" ng-model="deleted"> deleted (apply "strike" class)</label><br>
<label><input type="checkbox" ng-model="important"> important (apply "bold" class)</label><br>
<label><input type="checkbox" ng-model="error"> error (apply "red" class)</label>
<hr>
<p ng-class="style">Using String Syntax</p>
<input type="text" ng-model="style" placeholder="Type: bold strike red">
<hr>
<p ng-class="[style1, style2, style3]">Using Array Syntax</p>
<input ng-model="style1" placeholder="Type: bold, strike or red"><br>
<input ng-model="style2" placeholder="Type: bold, strike or red"><br>
<input ng-model="style3" placeholder="Type: bold, strike or red"><br>
</div>
body { font-size:14px; font-family: Arial; }
p { font-size:16px; }
/*ng-class: object*/
.strike {
text-decoration: line-through;
}
.bold {
font-weight: bold;
}
.red {
color: red;
}
/*ng-class: string*/
.good {
color: #690;
font-size: 20px;
}