diff options
| author | Igor Minar | 2010-11-24 16:55:44 -0800 |
|---|---|---|
| committer | Igor Minar | 2010-11-24 16:55:44 -0800 |
| commit | 7c82c4f83756b8b62231b46f864fb1107db0f989 (patch) | |
| tree | b50f430565e7cf88af753c9905261d943d1def41 /src/Angular.js | |
| parent | 97b1371199e4c514a23edad4546536616e0f9004 (diff) | |
| download | angular.js-7c82c4f83756b8b62231b46f864fb1107db0f989.tar.bz2 | |
docs for angular.Object and angular.Object.equals
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Angular.js b/src/Angular.js index 205b91e3..7d6f8502 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -760,6 +760,39 @@ function copy(source, destination){ return destination; } + +/** + * @workInProgress + * @ngdoc function + * @name angular.Object.equals + * @function + * + * @description + * Determines if two objects or value are equivalent. + * + * To be equivalent, they must pass `==` comparison or be of the same type and have all their + * properties pass `==` comparison. + * + * Supports values types, arrays and objects. + * + * For objects `function` properties and properties that start with `$` are not considered during + * comparisons. + * + * @param {*} o1 Object or value to compare. + * @param {*} o2 Object or value to compare. + * @returns {boolean} True if arguments are equal. + * + * @example + Salutation: <input type="text" name="master.salutation" value="Hello" /><br/> + Name: <input type="text" name="master.name" value="world"/><br/> + <button ng:click="form = master.$copy()">copy</button> + <hr/> + + Master is <span ng:hide="master.$equals(form)">NOT</span> same as form. + + <pre>master={{master}}</pre> + <pre>form={{form}}</pre> + */ function equals(o1, o2) { if (o1 == o2) return true; var t1 = typeof o1, t2 = typeof o2, length, key, keySet; |
