forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelloworld.html
30 lines (28 loc) · 1.41 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
<h1>Cookbook: Hello World</h1>
<div class="cookbook-hello-world"><fieldset class="workInProgress"><legend>Work in Progress</legend>
This page is currently being revised. It might be incomplete or contain inaccuracies.</fieldset>
<doc:example>
<pre class="doc-source">
Your name: <input type="text" name="name" value="World"/>
<hr/>
Hello {{name}}!
</pre>
<pre class="doc-scenario">
it('should change the binding when user enters text', function(){
expect(binding('name')).toEqual('World');
input('name').enter('angular');
expect(binding('name')).toEqual('angular');
});
</pre>
</doc:example><h2>Things to notice</h2>
<p>Take a look through the source and note:</p>
<ul>
<li>The script tag that <a href="#!/guide/dev_guide.bootstrap">bootstraps</a> the angular environment.</li>
<li>The text <a href="#!/api/angular.widget.HTML"><code>input widget</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/angular.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>