I am following form submission guidelines in the AngularJS documentation, however the form is not being submitted when I hit the Enter key. What do I need to do make this work? Here's my code. The important bit is that I am using ng-click to specify a handler for the submit button:
(Edit 1: Code below edited based on @Pavel Horal's suggestion. Buttons have been moved into the form. Still no luck.)
(Edit 2: This code actually works. You have to be in an input field when you press enter. This solves the issue.)
<div class="modal-body">
<form>
<div class="form-group">
<label for="payee">Payee</label>
<input type="text" class="form-control" id="payee" placeholder="Enter payee"
ng-model="vm.txn.payee" required>
</div>
<div class="form-group">
<label for="memo">Memo</label>
<input type="text" class="form-control" id="memo" placeholder="Enter memo"
ng-model="vm.txn.memo">
</div>
...
<button type="submit" class="btn btn-info" ng-click="vm.ok()">OK</button>
<button type="button" class="btn btn-default" ng-click="vm.cancel()">Cancel</button>
</form>
</div>
<div class="modal-footer">
</div>
<form>element. Submit via Enter key is a feature of a browser, not Angular's. When hitting Enter the browser finds first<input type="submit">,<input type="image">or<button type="submit">and submits the form while activating that control .