htmlclassfont-awesomebatman.jsdashing

How do I bind multiple classes in batman.js?


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?


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!