Mati Tucci
Mati Tucci

Reputation: 2976

Toggle a CSS class in Vue 2.0

In vue 1 I was doing this: v-bind:class='{"isdanger": invalidLogin}'.

Now I'm trying to do the same in a Vue 2 app but I'm getting this error:

template syntax error - invalid expression: v-bind:class="{'isdanger': invalidLogin}"

I'm using pug, just in case.

Any ideas?

Upvotes: 5

Views: 869

Answers (1)

Mati Tucci
Mati Tucci

Reputation: 2976

Sigh, I changed it to double quotes like this: v-bind:class="{'is-danger': true}" and now it works.

Upvotes: 9

Related Questions