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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: angular/angular.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: joelhooks/angular.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Apr 22, 2014

  1. ngModelOptions debounce was failing when specifying an event with a v…

    …alue of 0
    
    Was testing ngModelOptions, and noticed that the provided example
    `ngModelOptions="{ updateOn: 'default blur', debounce: {'default': 500, 'blur':
    0} }"` didn't function. With a little investigating I determined that the logic
    operation was skipping debounce[trigger] if it was 0 (thanks JS falsiness!).
    
    My first solution was to do this:
    
    ```javascript
    var debounceDelay = ctrl.$options && (
      isObject(ctrl.$options.debounce)
        ? (isNumber(ctrl.$options.debounce[trigger]) ?
        ctrl.$options.debounce[trigger]
                                                       :
                                                       (ctrl.$options.debounce['default']
                                                       || 0))
          : ctrl.$options.debounce
          ) || 0;
    ```
    
    Which hopefully makes us all cringe. Instead of adding this mess (the original
    logic took me about 30 minutes to understand), I decided to unroll it into
    something a bit less... terse.
    
    I added a unit test to cover this scenario.
    joelhooks committed Apr 22, 2014
    Configuration menu
    Copy the full SHA
    afd4bb4 View commit details
    Browse the repository at this point in the history
Loading