Skip to content

Instantly share code, notes, and snippets.

@iBasit
Created November 3, 2015 20:10
Show Gist options
  • Save iBasit/2fcbc077231265f3d7f1 to your computer and use it in GitHub Desktop.
Save iBasit/2fcbc077231265f3d7f1 to your computer and use it in GitHub Desktop.
app.directive('mysubmit', function(){
return {
restrict: 'A',
require: '^form',
link: function(scope, element, attrs, formCtrl)
{
console.log('found it');
element.on('click', function(event)
{
console.log('submitting form')
//do stuff before submitting
formCtrl.submit(); //manually submitting form in angular way.
$scope.$apply(); //running digest manually
})
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment