In form, how to get data from current selected item of collection container?

My form will contain a container that will link to a JSON array as its collection.

The array will be user task list that is loaded from REST API.

There will be a button in the container that will call a javascript expression to do some stuff for me. If there are, for example, 4 tasks, there will be 4 container for each task, each with its own button. The js expression will need the task id as a parameter.

The default button widget have no option to call javascript function/expression, so I create a custom one that can do that. However, in the js expression, I have no idea how to get the task id of the button that I press.

Anyone know how to do it?

Hi,

You can add a property to your custom button to bind some variables from your form/page to your widget.
Either a taskId property or something more generic depending on what you need.

This property can then be retrieved in your AngularJS template or js controller.

HTH
Romain