MarkPieszak / Angular1-ngForm-ngSubmit-fixes

Fix Angular1.* ng-form & ng-submit issues. AngularJS by default doesn't handle <ng-form> the way a typical <form> is handled, Enter keypress doesn't submit, ng-submit also doesn't work with it. Fix all of those issues with this directive override.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular 1.* ng-form & ng-submit fixes.

Fix <ng-form> Enter keypress & <ng-submit> functionality to work the way <form> tags do!

With no jQuery dependency!

Helpful for ASP.NET Webforms sites using Angular1.* since nested <form> tags aren't allowed.

DEMO : View it in Action!

Choose what the Enter key does in any given area in Angular - run any scoped function you want

Helpful with <ng-form> tags since they don't automatically handle Enter keys for submitting the form. This can also be used anywhere to simply run a specific function on the scope that's passed into the attribute.

Check out demo.html to see it in action

ngForm directive useage: (Automatically calls any input/button with type="submit")

<ng-form>
    <!-- some inputs -->
    <button type="submit"
        ng-click="vmDemo.submitThisForm()">
        Submit Button
    </button>
</ng-form>

ngSubmit functionality fix for ngForm:

<ng-form ng-submit="vmDemo.submitThisForm()">
    <!-- some inputs -->
    <button type="submit">
        Submit Button
    </button>
</ng-form>

Handle Enter keypress on any parent item:

<div on-enter="vmDemo.submitThisForm()">
    <!-- some inputs -->
    <button type="submit"
        ng-click="vmDemo.submitThisForm()">
        SAVE
    </button>
</div>

About

Fix Angular1.* ng-form & ng-submit issues. AngularJS by default doesn't handle <ng-form> the way a typical <form> is handled, Enter keypress doesn't submit, ng-submit also doesn't work with it. Fix all of those issues with this directive override.

License:Other


Languages

Language:HTML 61.5%Language:JavaScript 38.5%