dimanche 17 décembre 2017

Vue.js problems with if statement. Working really wierd

I will show you my problem as simple as it's possible:

Using:

Vue.js, TWIG, iCheck (if that matter).

Fields:

userEditObj.role - ["1","2","3"] that's from Vue.js

kid.id - 1 this is from TWIG

Problem:

${ userEditObj.role.indexOf() > 0 ? true : false } - working well.

Here I want to set checked attribute of my checkbox depends of the statement result (true or false)

:checked="userEditObj.role.indexOf() > 0 ? true : false" - it is not working. ALWAYS true.

Also i was trying to do that:

:checked="userEditObj.role.indexOf()" - same. Always true.

I heared that i can't use mustaches inside HTML attributes, but I can't even find replacement for that.

Aucun commentaire:

Enregistrer un commentaire