I have an x-editable form with several fields in it. I've only show the checkbox field here for brevity. There is an edit button that opens all of the elements for editing and when I click submit all of the elements are saved. While in edit mode I want to be able to call a function when the checkbox is clicked before submitting the form. It will be for validation to make sure the user really wants to uncheck the box. I want to prevent the default behavior of the checkbox and display a dialog for confirmation. This is simple with a regular checkbox but I can figure out how to do it with x-editable . ng-click doesnt seem to work. As you can see from the example e-onClick works but only with built in functions like alert() and console.log().
<form editable-form name="tableform" onaftersave="save()"oncancel="cancel()">
<table>
<tr>
<th>Active:</th>
<td>
<span editable-checkbox="user.active" e-form="tableform" e-onClick="console.log('test')"> {{user.active)}}
</span>
</td>
</tr>
</table>
</form>
I want to do some thing like this:
<span editable-checkbox="user.active" e-form="tableform" e-onClick="confirm($event)"> {{user.active)}}
</span>
and in my controller do something like this:
$scope.confirm = function($event){
$event.preventDefault();
// show confirmation code
};
Aucun commentaire:
Enregistrer un commentaire