forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.scope.$get.html
27 lines (27 loc) · 1.42 KB
/
angular.scope.$get.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
<h1>angular.scope.$get</h1>
<div class="angular-scope-get"><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>
<div class="description"><p>Returns the value for <code>property_chain</code> on the current scope. Unlike in JavaScript, if there
are any <code>undefined</code> intermediary properties, <code>undefined</code> is returned instead of throwing an
exception.</p><div ng:non-bindable><pre class="brush: js; html-script: true;">
var scope = angular.scope();
expect(scope.$get('person.name')).toEqual(undefined);
scope.person = {};
expect(scope.$get('person.name')).toEqual(undefined);
scope.person.name = 'misko';
expect(scope.$get('person.name')).toEqual('misko');
</pre></div></div>
<h2>Usage</h2>
<div class="usage"><div ng:non-bindable=""><pre class="brush: js; html-script: true;">angular.scope.$get(property_chain);</pre>
</div>
<h3>Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">property_chain – {string} – </code>
<p>String representing name of a scope property. Optionally
properties can be chained with <code>.</code> (dot), e.g. <code>'person.name.first'</code></p></li>
</ul>
<h3>Returns</h3>
<div class="returns"><code ng:non-bindable="">{*}</code>
– <p>Value for the (nested) property.</p></div>
</div>
</div>