You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AngularJS/index.html
+58-12Lines changed: 58 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -334,37 +334,83 @@ <h3>Directives</h3>
334
334
<imgsrc="img/reuse2.png" />
335
335
336
336
<asideclass="notes">
337
-
And its not just tabs. Think about all these components that you could build using this features.
337
+
And its not just tabs. Think about all these components that you could build using this feature. You can also share it within/outside of your project. These components can be stateless or stateful.
So reusable components feature in Angular is built with existing JS & DOM APIs. It's available in all the browsers. And it is also being proposed to become native for all modern browsers. It's already been implemented in Chrome Dev versions.
<li>Angular waits for <code>DOMContentLoaded</code> event</li>
363
+
<li>Angular looks for <ahref="api/ng.directive:ngApp"><code>ng-app</code></a>
364
+
<ahref="guide/directive">directive</a>, which designates the application boundary</li>
365
+
<li>The <ahref="guide/module">Module</a> specified in <ahref="api/ng.directive:ngApp"><code>ng-app</code></a> (if any) is used to configure
366
+
the <ahref="api/AUTO.$injector"><code>$injector</code></a></li>
367
+
<li>The <ahref="api/AUTO.$injector"><code>$injector</code></a> is used to create the <ahref="api/ng.$compile"><code>$compile</code></a> service as well as <ahref="api/ng.$rootScope"><code>$rootScope</code></a></li>
368
+
<li>The <ahref="api/ng.$compile"><code>$compile</code></a> service is used to compile the DOM and link
369
+
it with <ahref="api/ng.$rootScope"><code>$rootScope</code></a></li>
370
+
<li>The <ahref="api/ng.directive:ngInit"><code>ng-init</code></a><ahref="guide/directive">directive</a> assigns <code>World</code> to the <code>name</code> property on the <ahref="guide/scope">scope</a></li>
371
+
<li>The <code>{{name}}</code><ahref="api/ng.$interpolate"><code>interpolates</code></a> the expression to
<ol><li>the <ahref="api/ng.directive:ngModel"><code>ng-model</code></a> and <ahref="api/ng.directive:input"><code>input</code></a><ahref="guide/directive">directive</a> set up a <code>keydown</code> listener on the <code><input></code> control.</li>
captures the change to the input's value and calls <ahref="api/ng.$rootScope.Scope#$apply"><code>$apply</code></a><code>("name = 'X';")</code> to update the
388
+
application model inside the Angular execution context.</li>
389
+
<li>Angular applies the <code>name = 'X';</code> to the model.</li>
<li>The <ahref="api/ng.$rootScope.Scope#$watch"><code>$watch</code></a> list detects a change
392
+
on the <code>name</code> property and notifies the <ahref="api/ng.$interpolate"><code>{{name}}</code></a> interpolation, which in turn updates the DOM.</li>
393
+
<li>Angular exits the execution context, which in turn exits the <code>keydown</code> event and with it
394
+
the JavaScript execution context.</li>
395
+
<li>The browser re-renders the view with update text.</li></ol></li>
0 commit comments