forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.Object.equals.html
37 lines (31 loc) · 1.66 KB
/
angular.Object.equals.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<h1>angular.Object.equals</h1>
<fieldset class="workInProgress"><legend>Work in Progress</legend>
This page is currently being revised. It might be incomplete or contain inaccuracies.</fieldset>
<h2>Description</h2>
<p>Determines if two objects or value are equivalent.</p>
<p>To be equivalent, they must pass <code>==</code> comparison or be of the same type and have all their
properties pass <code>==</code> comparison.</p>
<p>Supports values types, arrays and objects.</p>
<p>For objects <code>function</code> properties and properties that start with <code>$</code> are not considered during
comparisons.</p>
<p>Note: this function is used to augment the Object type in angular expressions. See
<a href="#!angular.Object"><code>angular.Object</code></a> for more info.</p><h2>Usage</h2>
<div ng:non-bindable=""><pre class="brush: js; html-script: true;">angular.Object.equals(o1, o2);</pre>
</div>
<h3>Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">o1 – {*} – </code>
Object or value to compare.</li>
<li><code ng:non-bindable="">o2 – {*} – </code>
Object or value to compare.</li>
</ul>
<h3>Returns</h3>
<code ng:non-bindable="">boolean</code>
– True if arguments are equal.<h2>Example</h2>
<doc:example><doc:source>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></doc:source>
</doc:example>