I am attempting to use an ng-submit call to fire a submit event to my custom directive, but it isn't firing.
Here is a plunk that illustrates my problem.
<div ng-controller="MyCtrl">
<form name="loginForm" ng-submit="login()" novalidate="">
<input type="submit" class='please-wait' value="Submit Me" />
</form>
</div>
js code:
app.directive('pleaseWait', function () {
return {
restrict: "C",
compile: function (element) {
element.on('submit', function (e) {
alert('Submit called');
});
element.on('click', function (e) {
alert('Click called');
});
}
};
});
http://plnkr.co/edit/lwHPVJI75q8bvVoSX1WP?p=preview
What am I doing wrong?
submitis an event of form, not input