Giter Site home page Giter Site logo

markpieszak / angular1-ngform-ngsubmit-fixes Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 5.0 32 KB

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

HTML 61.53% JavaScript 38.47%

angular1-ngform-ngsubmit-fixes's Introduction

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.

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.