@@ -7,40 +7,38 @@ block includes
7
7
Just open it and follow along with the documentation.
8
8
If you'd rather develop in a local environment, learn how on the [Setup](guide/setup.html) page.
9
9
10
- Here's a super-simple Angular application:
10
+ Angular applications are made of _components_.
11
+ A _component_ is the combination of an HTML template and a component class that controls a portion of the screen.
12
+ Here's a super-simple Angular component, written in [TypeScript](#typescript):
11
13
12
- + makeExample('app/app.module .ts' ,'' ,'app/app.module .ts' )( format ='.' )
14
+ + makeExample('app/app.component .ts' ,'' ,'app/app.component .ts' )( format ='.' )
13
15
:marked
14
- ### _AppComponent_
15
- Angular applications are made of _components_.
16
- A _component_ is the combination of an HTML template and JavaScript class that controls a portion of the screen.
16
+ The `@Component` [_decorator_](glossary.html#decorator '"Decorator" explained') function takes a _metadata_ object that
17
+ describes how the HTML template and component class work together.
17
18
18
- According to the `selector`, this `AppComponent` displays its content inside a custom `<my-app>` tag in the `index.html`.
19
- + makeExample('index.html' ,'my-app' ,'index.html (body)' )( format ='.' )
19
+ The `selector` property tells Angular to display the component inside a custom `<my-app>` tag in the `index.html`.
20
+ + makeExample('index.1. html' ,'my-app' ,'index.html (body)' )( format ='.' )
20
21
:marked
21
- The `AppComponent` template renders the message, "Hello Angular", inside an `<h1>` header.
22
- The word "Angular" appears thanks to an [interpolation binding](guide/displaying-data.html)
23
- that projects the component's `title` property into the `{{title}}` slot.
24
- Change the property value from `'Angular'` to `'World'` and see what happens.
22
+ The `template` property defines a message inside an `<h1>` header.
23
+ The message starts with "Hello" and ends with `{{name}}`
24
+ which is an Angular [interpolation binding](guide/displaying-data.html) expression.
25
+ At runtime, Angular replaces `{{name}}` with the value of the component's `name` property.
26
+ Change the component class's `name` property from `'Angular'` to `'World'` and see what happens.
25
27
26
28
Binding is one of many Angular features you'll discover in this documentation.
29
+
30
+ .l-sub-section
31
+ :marked
32
+ ### Next step
33
+ Start [learning Angular](guide/learning-angular.html).
27
34
28
- ### _AppModule_
29
- The `AppModule` tells Angular<br>
30
- ***what you need*** — _imports_ the `BrowserModule` to run the application in the browser.<br>
31
- ***what you created*** — _declares_ the `AppComponent`.<br>
32
- ***what to show*** — _bootstrap_ the `AppComponent` onto the `index.html` web page within the `<my-app>` tag.
33
-
34
- You'll find more _live code examples_ like this one on almost every documentation page.
35
-
36
- # TypeScript
35
+ .l-main-section
36
+ a#typescript
37
+ :marked
38
+ ## TypeScript
37
39
This example is written in <a href="http://www.typescriptlang.org/" target="_blank" title="TypeScript">TypeScript</a>,
38
40
a strongly-typed, super-set of the latest JavaScript.
39
41
TypeScript turns into JavaScript that runs on any modern browser.
40
42
Most developers find it delightful which is why most Angular developers write applications in TypeScript.
41
43
You can write your application in [other versions of JavaScript](cookbook/ts-to-js.html) if you prefer.
42
-
43
- .l-sub-section
44
- :marked
45
- ### Next step
46
- Start [learning Angular](guide/learning-angular.html).
44
+
0 commit comments