I am using angular-formly, I am trying to add the normal angular events to a checkbox but no joy. Here is what I have:
{
type: "checkbox",
key: "is_active",
templateOptions: {
type: "",
label: "Is Active"
}
}
I looked over the documentations over and over and I can not find the solution. Please show where to add ng-click or ng-change in the above.
I hoped something like the below would work:
{
type: "checkbox",
key: "is_active",
templateOptions: {
type: "",
label: "Is Active"
},
ngClick : "functionName"
}
where functionName
is a function inside the controller that renders the form. So my functions will always be in my controller, I just need to define or pass the event to the checkbox
It's been awhile since I've messed with formly but I believe this should do
{
type: "checkbox",
key: "is_active",
templateOptions: {
type: "",
label: "Is Active",
onClick: yourControllerFunctionHere //notice this isn't a string but a reference to your controller function
}
}
This is referenced in the ngModelAttrsTemplateManipulator documentation. I love formly but the documentation is hard to navigate