I'm trying to submit a form with AngularJS without use $http. I'm checking the form via Javascript, but not sure how to submit after the check is complete. Sample code looks like this:
AngularJS
 app.directive('checkLoggedinSubmit', ['account_id', 'session', 'LoginModal',
    function(account_id, session, LoginModal) {
        return {
            restrict : 'A',
            link : function(scope, element, attrs) {
                element.bind('submit', function(e) {
                    e.preventDefault();             
                    //If not logged in, show logged in, otherwise subit
                    if (!account_id && !session.read('account_id')) {
                        LoginModal.show();
                    } else {
                        scope.$eval(attrs.checkLoggedinSubmit);
                        scope.$apply();
                        //Tried To use JQuery
                        //$(e.currentTarget).submit();
                    }
                });
            }
        };
}]);
HTML Form
<form role="form" enctype="multipart/form-data" method="post" action="/file/submit" class="well" style="padding: 0px 20px 20px;" check-loggedin-submit >
    <div class="form-group">
        <input type="file" name="my_file" />
    </div>
    <div class="form-group">
        <input type="submit" class="btn btn-success"  />
    </div>
</form>
I tried to have JQuery submit the form, but threw errors. Anyone now how to solve this?


e.preventDefault();call to inside yourifstatement, so it will be called only when needed.