mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-06-18 03:58:15 +08:00
docs(NgModelController): clarify the value parameter for $isEmpty
This commit is contained in:
@@ -1814,17 +1814,18 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
|
||||
* @name ngModel.NgModelController#$isEmpty
|
||||
*
|
||||
* @description
|
||||
* This is called when we need to determine if the value of the input is empty.
|
||||
* This is called when we need to determine if the value of an input is empty.
|
||||
*
|
||||
* For instance, the required directive does this to work out if the input has data or not.
|
||||
*
|
||||
* The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.
|
||||
*
|
||||
* You can override this for input directives whose concept of being empty is different to the
|
||||
* default. The `checkboxInputType` directive does this because in its case a value of `false`
|
||||
* implies empty.
|
||||
*
|
||||
* @param {*} value Reference to check.
|
||||
* @returns {boolean} True if `value` is empty.
|
||||
* @param {*} value The value of the input to check for emptiness.
|
||||
* @returns {boolean} True if `value` is "empty".
|
||||
*/
|
||||
this.$isEmpty = function(value) {
|
||||
return isUndefined(value) || value === '' || value === null || value !== value;
|
||||
|
||||
Reference in New Issue
Block a user