Here we have a very simple component with some predefined styles. If you need to add multiple CSS class to DOM element within our component, for instance, this div here, we can use the ng-class.
Let's use here ng-class's variable, which we define directly inside our component here. This variable is directly bound to that ng-class definition up here.
What we can do now is to directly here specify the name of the CSS class, and you can see how it gets applied to our DOM element. We can also directly add a space here and add further classes. As you can see, all of them get applied.
Another possibility is to use an array, so we could wrap this in an array here. As you can see, it still works. Can also remove one, and it works again. Obviously, these can be added dynamically within your application codes, so you can add or remove classes here from that array.
A third possibility which we have is to use an object. The main advantage of using an object is that we get another value here. Being a key value kind of data structure, we can add here Boolean conditions.
Let's wrap this a bit nicer here so that we get a better sight of the variables. We'll add here a little bit of condition, and let's add false for the highlight, and let's add true for the strike. As you can see, based on the outcome of these values, the classes get applied or not.
Obviously, we need to bind them, isBold, isHighlight, and isStrike. To get a better effect here, let's add some check boxes. Great. As you can see, the check boxes are two-way data-bound to our variables, which we have defined here below.
In turn, those variables are data-bound via that ng-class directive here. Now we can then activate or deactivate different kind of styles, and even multiple styles.