Chic-a-Chic-a-CheckBox
Im going to try to keep my future posts short and simple.
KISS
Ahhh…. the beautiful checkbox in your form. You just love clicking it don’t you?
Well, lets put one in!
Template
{% highlight html %}
Component
{% highlight javascript %}data = {1:'undefined'}
onCheckBox(loc){
//store the checkBox answers however you would like.
// I use FormBuilder and then insert the checkBox Answers into my form on submittal
let ans = this.data[loc]
if(ans == 'undefined' || ans == 'false'){
this.data[loc] = 'true'
console.log('this.data true***', this.data)
}
else{
this.data[loc] = 'false'
console.log('this.data false***', this.data)
}
}
}
{% endhighlight %}