Working on a view that has checkboxes inside a v-for loop:
<ul class="object administrator-checkbox-list">
<li v-for="module in modules">
<label v-bind:for="module.id">
<input type="checkbox" v-model="form.modules" v-bind:value="module.id" v-bind:id="module.id" v-if=>
<span>@{{ module.name }}</span>
</label>
</li>
</ul>
I also have a data of 'form' (using Laravels Spark Form Object) that has access to a 'currentModules' property that consists of the current resources relationship to a modules table.
I am looking to check the checkboxes that exist in the currentModules property.
Example of the 'modules' data used in the v-for the data:
[
{
"id": 1,
"name": "Business",
"created_at": "2016-11-23 09:57:03",
"updated_at": "2016-11-23 09:57:03"
},
{
"id": 2,
"name": "Houses",
"created_at": "2016-11-23 09:57:03",
"updated_at": "2016-11-23 09:57:03"
}
]
And the data from 'form.currentModules' is the exact same format. How can I check the checkboxs if the module id is in the currentModules using Vue?
form.currentModules
when the checkbox is clicked? – asemahle Dec 6 at 16:21