1

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?

Soler
  • 119
  • 1
  • 7
  • What is the reason for the dynamic class? Perhaps there is a different way to accomplish what you want without a dynamic class? You could use JS – joshmmo Oct 10 '13 at 21:13
  • Well the icon is changing based on what is determined to be displayed in the Ruby job. From what I understand, that is the whole purpose of the batman bindings. I just need to way to combine them. I actually think I could just set the icon in the Ruby job to something like "icon-circle icon-large" and then when it is passed up item.icon will populate it correctly. I will have to give that a shot. – Soler Oct 13 '13 at 05:57

1 Answers1

4

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!

rmosolgo
  • 1,854
  • 1
  • 18
  • 23