forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelloworld.html
52 lines (48 loc) · 2.2 KB
/
helloworld.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<h1><code ng:non-bindable=""></code>
<span class="hint"></span>
</h1>
<div><h3>Source</h3>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-10" source-edit-css="" source-edit-js="script.js-9" source-edit-unit="" source-edit-scenario="scenario.js-11"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-10" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-10">
<div ng-controller="HelloCntl">
Your name: <input type="text" ng-model="name" value="World"/>
<hr/>
Hello {{name}}!
</div>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-9"></pre>
<script type="text/ng-template" id="script.js-9">
function HelloCntl($scope) {
$scope.name = 'World';
}
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-11"></pre>
<script type="text/ng-template" id="scenario.js-11">
it('should change the binding when user enters text', function() {
expect(binding('name')).toEqual('World');
input('name').enter('angular');
expect(binding('name')).toEqual('angular');
});
</script>
</div>
</div><h3>Demo</h3>
<div class="well doc-example-live" ng-embed-app="" ng-set-html="index.html-10" ng-eval-javascript="script.js-9"></div>
<h2>Things to notice</h2>
<p>Take a look through the source and note:</p>
<ul>
<li>The script tag that <a href="guide/bootstrap">bootstraps</a> the angular environment.</li>
<li>The text <a href="api/ng.directive:input"><code>input form control</code></a> which is
bound to the greeting name text.</li>
<li>No need for listener registration and event firing on change events.</li>
<li>The implicit presence of the <code>name</code> variable which is in the root <a href="api/ng.$rootScope.Scope"><code>scope</code></a>.</li>
<li>The double curly brace <code>{{markup}}</code>, which binds the name variable to the greeting text.</li>
<li>The concept of <a href="guide/dev_guide.templates.databinding">data binding</a>, which reflects any
changes to the
input field in the greeting text.</li>
</ul></div>