angular-cn/public/docs/ts/latest/quickstart.jade

57 lines
2.5 KiB
Plaintext
Raw Normal View History

include _util-fns
:marked
The **QuickStart playground** is the easiest way to discover Angular.
You don't need to install anything.
Just click the image below, launch the live-coding environment, and start entering code.
<live-example embedded img="devguide/quickstart/quickstart-plnkr-big.png"><live-example>
The QuickStart displays a super-simple Angular component, written in [TypeScript](#typescript):
+makeExample('app/app.component.ts','','app/app.component.ts')(format='.')
:marked
Angular applications are made of _components_.
A _component_ is the combination of an HTML template and a component class that controls a portion of the screen.
Every component begins with a `@Component` [_decorator_](glossary.html#decorator '"Decorator" explained') function
that takes a _metadata_ object. The metadata describe how the HTML template and component class work together.
The `selector` property tells Angular to display the component inside a custom `<my-app>` tag in the `index.html`.
+makeExample('index.html','my-app','index.html (inside <body>)')(format='.')
:marked
The `template` property defines a message inside an `<h1>` header.
The message starts with "Hello" and ends with `{{name}}`
which is an Angular [interpolation binding](guide/displaying-data.html) expression.
At runtime, Angular replaces `{{name}}` with the value of the component's `name` property.
Change the component class's `name` property from `'Angular'` to `'World'` and see what happens.
Binding is one of many Angular features you'll discover in this documentation.
.l-sub-section
:marked
### Next step
This QuickStart playground is fine for exploring Angular
but you won't develop a real application there.
You'll want to develop locally on your own machine.
Visit the [**setup guide**](guide/setup.html "Install Angular for local development") to learn how.
.l-main-section
a#typescript
:marked
## TypeScript
This example is written in <a href="http://www.typescriptlang.org/" target="_blank" title="TypeScript">TypeScript</a>,
a typed super-set of the latest JavaScript.
TypeScript compiles into JavaScript that runs on any modern browser.
Most developers find it delightful which is why most Angular developers write applications in TypeScript.
You can write your application in
[other versions of JavaScript](cookbook/ts-to-js.html "TypeScript to JavaScript")
if you prefer.
//
[Dart](../../dart/latest)
or <a href="https://github.com/angular/dart/latest" target="_blank" title="Dart">Dart</a> if you prefer.