What is the "AngularJS way" of doing a form submit when any of its inputs have been clicked (or changed)?
<form ng-submit="submit($event)" id="myForm">
<input type="checkbox" name="foo" value="bar" ng-click="???"/>
</form>
I'm tempted to use jQuery and simply doing ng-click="$('#myForm').submit()"
, but it's probably worth learning it properly.
I have tried doing ng-click="submit($event)"
, but the error here is the $event
object within the scope of the input
instead of the entire form
(correct me if I'm wrong, this is what I'm getting from the documentation).
?foo=bar
) in my$scope.submit
function. In jQuery I would use$(event.currentTarget).serialize();
. How would I console.log the query string using plain angular/jQLite? – Dorwin