How do I populate this checkbox with the data from an array in my controller?
My-view.js
function arrayBlock() {
return createModalBlock('Engage', [
{
type: 'section',
text: {
type: 'mrkdwn',
text: 'This is a section block with checkboxes.'
},
accessory: {
type: 'checkboxes',
options: [
{
text: {
type: 'mrkdwn',
text: 'Option 1'
},
description: {
type: 'mrkdwn',
text: 'user description'
},
value: 'value-0'
}
],
action_id: 'checkboxes-action'
}
}
], {
close: {
type: 'plain_text',
text: 'Close',
},
});
}
controller.js
arr = ["option 1", "option 2", "option 3", "option 4", "option 5"]

I can't copy your code, since you posted it as a
Image, but this is how you can do it:Using
arr.map()will solve your problem.