Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

feat(ngModelOptions): Model update behavior can now be customized #6945

Closed
wants to merge 4 commits into from

Commits on Mar 28, 2014

  1. Configuration menu
    Copy the full SHA
    c704f76 View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2014

  1. feat(ngModelOptions): Model update behavior can now be customized

    By default, any change on the content will trigger an immediate model update
    and form validation. This PR implements a new directive `ng-model-options`
    that allow you to override this default behavior in several ways.
    
    You should specify an object with the different parameters.
    
    For example, it allows to trigger an update only when a particular event or
    list of events is received by the input using the `updateOn` key. Should you
    need multiple events, just assign an array to it.
    
    I.e. `ng-model-options="{ updateOn: 'blur' }"` will update and validate only
    after the control loses focus.
    
    If you want to keep the default behavior and just add new events that may
    trigger the model update and validation, add "default" as one of the specified
    events.
    
    I.e. `ng-model-options="{ updateOn: ['default','submit'] }"`
    
    Also, with the `debounce` option, `ng-model-options` will allow deferring the
    actual model update until a timer expires. The timer will be reset each time
    an event is triggered.
    
    I.e. `ng-model-options="{ debounce: 500 }" for 500ms after the latest event.
    
    Custom timeouts for each event can be set for each event if you use an object
    in `debounce`. This can be useful to force immediate updates on some specific
    circumstances (like blur events).
    
    I.e. `ng-model-options="{ updateOn: ['default', 'blur'], debounce: { default: 500, blur: 0} }"`
    
    You can use the directive in any tag so its contents became the default settings
    for any child control, although they can be overridden.
    
    Closes angular#1285, angular#2129
    lrlopez committed Apr 2, 2014
    Configuration menu
    Copy the full SHA
    c93c454 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2014

  1. Configuration menu
    Copy the full SHA
    a633144 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    70b8f40 View commit details
    Browse the repository at this point in the history