Static and dynamic class in the same element. Polymer

466 Views Asked by At

How to define in the same DOM element a dynamic class and another static?

I tried this:

class$="{{clase}} my-static-class" 
class$="[{{clase}}, 'my-static-class']" 
class$="{{clase}}" class="my-static-class"

but doesn't work.

1

There are 1 best solutions below

0
On BEST ANSWER

String interpolation is not yet supported on Polymer 1.0. However, you can use a computed binding for this.

Polymer({
  ...
  computeClass: function(someClass) {
    return someClass + ' my-static-class';
  }
});

And use accordingly:

<div class$="{{computeClass(clase)}}"></div>