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

Promise-based validations & Multi-stage validation API for ngModel #8267

Closed
wants to merge 2 commits into from

Commits on Aug 26, 2014

  1. fix(ngModel): treat undefined parse responses as parse errors

    With this commit, ngModel will now handle parsing first and then validation
    afterwards once the parsing is successful. If any parser along the way returns
    `undefined` then ngModel will break the chain of parsing and register a
    a parser error represented by the type of input that is being collected
    (e.g. number, date, datetime, url, etc...). If a parser fails for a standard
    text input field then an error of `parse` will be placed on `model.$error`.
    
    BREAKING CHANGE
    
    Any parser code from before that returned an `undefined` value
    (or nothing at all) will now cause a parser failure. When this occurs
    none of the validators present in `$validators` will run until the parser
    error is gone.
    matsko committed Aug 26, 2014
    Configuration menu
    Copy the full SHA
    c7f494c View commit details
    Browse the repository at this point in the history
  2. feat(ngModel): provide validation API functions for sync and async va…

    …lidations
    
    This commit introduces a 2nd validation queue called `$asyncValidators`. Each time a value
    is processed by the validation pipeline, if all synchronous `$validators` succeed, the value
    is then passed through the `$asyncValidators` validation queue. These validators should return
    a promise. Rejection of a validation promise indicates a failed validation.
    matsko committed Aug 26, 2014
    Configuration menu
    Copy the full SHA
    04ab51c View commit details
    Browse the repository at this point in the history