diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/directives.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/directives.js b/src/directives.js index 148e1f86..49f0343d 100644 --- a/src/directives.js +++ b/src/directives.js @@ -218,6 +218,25 @@ angularDirective("ng:click", function(expression, element){ }; }); + +/** + * 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). + */ +angularDirective("ng:submit", function(expression, element) { + return function(element) { + var self = this; + element.bind('submit', function(event) { + self.$tryEval(expression, element); + self.$root.$eval(); + event.preventDefault(); + }); + }; +}); + + angularDirective("ng:watch", function(expression, element){ return function(element){ var self = this; |
