I'm trying to implement IF
condition with true/false or 1/0 in Vue Component. I go through some earlier asked questions but not able to get it. Please help me out.
IF
condition not gives true
output even if dd
gives true
.
Controller (I tried with two ways so that either I may got success with true/false or 1/0, In both methods on page I'm able to get 1/0 or true/false with dd($isExamAssigned)):
dd($isExamAssigned); // here I'm able to get 1 or 0
blade.php:
<quiz-component
:isExamAssigned = "{{$isExamAssigned}}"
>
</quiz-component>
code part from Component.vue:
props:['isExamAssigned'],
data(){
return{
isExamAssigned :this.isExamAssigned,
}
and here is the IF condition:
<div v-if="isExamAssigned === '1'">
<!-- Code here for IF -->
</div>
<div v-else>
<!-- Code here for ELSE -->
</div>
I tried different ways to get the values, like:
<div v-if="isExamAssigned === 1">
<div v-if="isExamAssigned === true">
<div v-if="isExamAssigned">
but Im not able to implement condition.
Thanks.