angular.directive.ng:submit

Work in Progress This page is currently being revised. It might be incomplete or contain inaccuracies.

Description

Enables binding angular expressions to onsubmit events.

Additionally it prevents the default action (which for form means sending the request to the server and reloading the current page).

Usage

<form ng:submit="expression">
   ...
</form>

Parameters

Example

<form ng:submit="list.push(text);text='';" ng:init="list=[]"> Enter text and hit enter: <input type="text" name="text" value="hello"/> </form> <pre>list={{list}}</pre> it('should check ng:submit', function(){ expect(binding('list')).toBe('list=[]'); element('.doc-example-live form input').click(); this.addFutureAction('submit from', function($window, $document, done) { $window.angular.element( $document.elements('.doc-example-live form')). trigger('submit'); done(); }); expect(binding('list')).toBe('list=["hello"]'); });