Question

I am building a Dashings dashboard and using font-awesome to display icons in a widget. I am trying to bind a dynamic class and a static class to one tag in the html such as

<i data-bind-class="item.icon icon-large"></i>

but obviously this isn't working. What is the correct way to do it so that both classes apply?

Was it helpful?

Solution

Use Batman's append view filter. For example:

<i data-bind-class="item.icon | append ' icon-large'"></i>

Note that a string literal passed to append should be wrapped in quotes!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top