Determines if two objects or two values are equivalent. Supports value types, arrays and objects.
Two objects or values are considered equivalent if at least one of the following is true:
===
comparison.===
comparison.During a property comparision, properties of function
type and properties with names
that begin with $
are ignored.
Note: This function is used to augment the Object type in Angular expressions. See
angular.Array
for more information about Angular arrays.
angular.Object.equals(o1, o2);
o1 – {*} –
Object or value to compare.
o2 – {*} –
Object or value to compare.
{boolean}
– True if arguments are equal.
Salutation: <input type="text" name="greeting.salutation" value="Hello" /><br/> Name: <input type="text" name="greeting.name" value="world"/><br/> <hr/> The <code>greeting</code> object is <span ng:hide="greeting.$equals({salutation:'Hello', name:'world'})">NOT</span> equal to <code>{salutation:'Hello', name:'world'}</code>. <pre>greeting={{greeting}}</pre>
it('should print that initialy greeting is equal to the hardcoded value object', function() { expect(element('.doc-example-live input[name=greeting.salutation]').val()).toBe('Hello'); expect(element('.doc-example-live input[name=greeting.name]').val()).toBe('world'); expect(element('.doc-example-live span').css('display')).toBe('none'); }); it('should say that the objects are not equal when the form is modified', function() { input('greeting.name').enter('kitty'); expect(element('.doc-example-live span').css('display')).toBe('inline'); });