I have a multiselect field in angular-formly, with the following options:
vm.fields = [
I wrote a working example here https://jsbin.com/dukewac/6/edit?js,output
The signature of templateOptions.onClick when a function is
$modelValue, fieldOptions, scope, event. This occurs when the ngModelAttrsTemplateManipulator is run. I leveraged these variables in my function.
Some of it is a bit hacky but that partially has to do with how angular implements checkboxes and the workarounds that the multiCheckbox type in angular-formly-templates-bootstrap employs.
This example will not work with nested keys but should if the multiCheckbox type was updated. This is because it is directly accessing the model using array access notation [see the code here] (https://github.com/formly-js/angular-formly-templates-bootstrap/blob/a69d69e5c3f6382ea6a6c028c1d8bf76a9b94db3/src/types/multiCheckbox.js).
The code also assumes that the 'ALL' option is the first in the list and that its value is 'ALL'. This could be fixed by adding a templateOption property that references what the index and value the all functionality is for.
'ALL' will appear in your model. A possible way to get around this would be to define a $parser for it.
templateOptions.valueProp is not taken into account but shouldn;t be too difficult to add.