0๐
โ
if(value)
was the answer here, to cover all the conditions I needed
so {{ myString ? ... : ... }}
๐คCQM
0๐
The ternary operator works fine on the template.
Check your myString
data it might not be empty.
<div>Empty: {{myString === "" ? 'test' : otherString}}<div>
<div>Non Empty: {{myString !== "" ? 'test' : otherString}}<div>
See the example below.
var app = new Vue({
el: '#app',
data() {
return {
myString: "",
otherString: "blah"
}
},
})
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
<div id="app">
<div>Empty: {{myString === "" ? 'test' : otherString}}<div>
<div>Non Empty: {{myString !== "" ? 'test' : otherString}}<div>
</div>
๐คcalmar
Source:stackexchange.com