docs(cheatsheet): add missing bootstrapping section
Closes #5269 Closes #5269
This commit is contained in:
parent
bccd8a719d
commit
c03fb36e11
@ -5,53 +5,5 @@ Bootstrapping
|
|||||||
`import {bootstrap} from 'angular2/angular2';`
|
`import {bootstrap} from 'angular2/angular2';`
|
||||||
|
|
||||||
@cheatsheetItem
|
@cheatsheetItem
|
||||||
`<input [value]="firstName">`|`[value]`
|
`bootstrap(MyAppComponent, [MyService, provide(...)]);`
|
||||||
Binds property `value` to the result of expression `firstName`.
|
Bootstraps an application with MyAppComponent as the root component and configures the DI providers.
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<div [attr.role]="myAriaRole">`|`[attr.role]`
|
|
||||||
Binds attribute `role` to the result of expression `myAriaRole`.
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<div [class.extra-sparkle]="isDelightful">`|`[class.extra-sparkle]`
|
|
||||||
Binds the presence of the css class `extra-sparkle` on the element to the truthiness of the expression `isDelightful`.
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<div [style.width.px]="mySize">`|`[style.width.px]`
|
|
||||||
Binds style property `width` to the result of expression `mySize` in pixels. Units are optional.
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<button (click)="readRainbow($event)">`|`(click)`
|
|
||||||
Calls method `readRainbow` when a click event is triggered on this button element (or its children) and passes in the event object.
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<div title="Hello {{ponyName}}">`|`{{ponyName}}`
|
|
||||||
Binds a property to an interpolated string, e.g. "Hello Seabiscuit". Equivalent to:
|
|
||||||
`<div [title]="'Hello' + ponyName">`
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<p>Hello {{ponyName}}</p>`|`{{ponyName}}`
|
|
||||||
Binds text content to an interpolated string, e.g. "Hello Seabiscuit".
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<my-cmp [(title)]="name">`|`[(title)]`
|
|
||||||
Sets up two-way data binding. Equivalent to: `<my-cmp [title]="name" (title-change)="name=$event">`
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<video #movieplayer ...>
|
|
||||||
<button (click)="movieplayer.play()">
|
|
||||||
</video>`|`#movieplayer`|`(click)`
|
|
||||||
Creates a local variable `movieplayer` that provides access to the `video` element instance in data-binding and event-binding expressions in the current template.
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<p *my-unless="myExpression">...</p>`|`*my-unless`
|
|
||||||
The `*` symbol means that the current element will be turned into an embedded template. Equivalent to:
|
|
||||||
`<template [myless]="myExpression"><p>...</p></template>`
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<p>Card No.: {{cardNumber | myCreditCardNumberFormatter}}</p>`|`{{cardNumber | myCreditCardNumberFormatter}}`
|
|
||||||
Transforms the current value of expression `cardNumber` via the pipe called `creditCardNumberFormatter`.
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
`<p>Employer: {{employer?.companyName}}</p>`|`{{employer?.companyName}}`
|
|
||||||
The Elvis operator (`?`) means that the `employer` field is optional and if `undefined`, the rest of the expression should be ignored.
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Built-in directives
|
Built-in directives
|
||||||
@cheatsheetIndex 1
|
@cheatsheetIndex 2
|
||||||
@description
|
@description
|
||||||
`import {NgIf, ...} from 'angular2/angular2';`
|
`import {NgIf, ...} from 'angular2/angular2';`
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Class decorators
|
Class decorators
|
||||||
@cheatsheetIndex 3
|
@cheatsheetIndex 4
|
||||||
@description
|
@description
|
||||||
`import {Directive, ...} from 'angular2/angular2';`
|
`import {Directive, ...} from 'angular2/angular2';`
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Component configuration
|
Component configuration
|
||||||
@cheatsheetIndex 5
|
@cheatsheetIndex 6
|
||||||
@description
|
@description
|
||||||
`@Component` extends `@Directive`,
|
`@Component` extends `@Directive`,
|
||||||
so the `@Directive` configuration applies to components as well
|
so the `@Directive` configuration applies to components as well
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Dependency injection configuration
|
Dependency injection configuration
|
||||||
@cheatsheetIndex 7
|
@cheatsheetIndex 9
|
||||||
@description
|
@description
|
||||||
`import {provide} from 'angular2/angular2';`
|
`import {provide} from 'angular2/angular2';`
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Class field decorators for directives and components
|
Class field decorators for directives and components
|
||||||
@cheatsheetIndex 6
|
@cheatsheetIndex 7
|
||||||
@description
|
@description
|
||||||
`import {Input, ...} from 'angular2/angular2';`
|
`import {Input, ...} from 'angular2/angular2';`
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Directive configuration
|
Directive configuration
|
||||||
@cheatsheetIndex 4
|
@cheatsheetIndex 5
|
||||||
@description
|
@description
|
||||||
`@Directive({ property1: value1, ... }) )`
|
`@Directive({ property1: value1, ... }) )`
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Forms
|
Forms
|
||||||
@cheatsheetIndex 2
|
@cheatsheetIndex 3
|
||||||
@description
|
@description
|
||||||
`import {FORM_DIRECTIVES} from 'angular2/angular2';`
|
`import {FORM_DIRECTIVES} from 'angular2/angular2';`
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Directive and component change detection and lifecycle hooks
|
Directive and component change detection and lifecycle hooks
|
||||||
@cheatsheetIndex 6
|
@cheatsheetIndex 8
|
||||||
@description
|
@description
|
||||||
(implemented as class methods)
|
(implemented as class methods)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Routing and navigation
|
Routing and navigation
|
||||||
@cheatsheetIndex 8
|
@cheatsheetIndex 10
|
||||||
@description
|
@description
|
||||||
`import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, ...} from 'angular2/router';`
|
`import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, ...} from 'angular2/router';`
|
||||||
|
|
||||||
|
56
modules/angular2/docs/cheatsheet/template-syntax.md
Normal file
56
modules/angular2/docs/cheatsheet/template-syntax.md
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
@cheatsheetSection
|
||||||
|
Template syntax
|
||||||
|
@cheatsheetIndex 1
|
||||||
|
@description
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<input [value]="firstName">`|`[value]`
|
||||||
|
Binds property `value` to the result of expression `firstName`.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<div [attr.role]="myAriaRole">`|`[attr.role]`
|
||||||
|
Binds attribute `role` to the result of expression `myAriaRole`.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<div [class.extra-sparkle]="isDelightful">`|`[class.extra-sparkle]`
|
||||||
|
Binds the presence of the css class `extra-sparkle` on the element to the truthiness of the expression `isDelightful`.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<div [style.width.px]="mySize">`|`[style.width.px]`
|
||||||
|
Binds style property `width` to the result of expression `mySize` in pixels. Units are optional.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<button (click)="readRainbow($event)">`|`(click)`
|
||||||
|
Calls method `readRainbow` when a click event is triggered on this button element (or its children) and passes in the event object.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<div title="Hello {{ponyName}}">`|`{{ponyName}}`
|
||||||
|
Binds a property to an interpolated string, e.g. "Hello Seabiscuit". Equivalent to:
|
||||||
|
`<div [title]="'Hello' + ponyName">`
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<p>Hello {{ponyName}}</p>`|`{{ponyName}}`
|
||||||
|
Binds text content to an interpolated string, e.g. "Hello Seabiscuit".
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<my-cmp [(title)]="name">`|`[(title)]`
|
||||||
|
Sets up two-way data binding. Equivalent to: `<my-cmp [title]="name" (title-change)="name=$event">`
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<video #movieplayer ...>
|
||||||
|
<button (click)="movieplayer.play()">
|
||||||
|
</video>`|`#movieplayer`|`(click)`
|
||||||
|
Creates a local variable `movieplayer` that provides access to the `video` element instance in data-binding and event-binding expressions in the current template.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<p *my-unless="myExpression">...</p>`|`*my-unless`
|
||||||
|
The `*` symbol means that the current element will be turned into an embedded template. Equivalent to:
|
||||||
|
`<template [myless]="myExpression"><p>...</p></template>`
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<p>Card No.: {{cardNumber | myCreditCardNumberFormatter}}</p>`|`{{cardNumber | myCreditCardNumberFormatter}}`
|
||||||
|
Transforms the current value of expression `cardNumber` via the pipe called `creditCardNumberFormatter`.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
`<p>Employer: {{employer?.companyName}}</p>`|`{{employer?.companyName}}`
|
||||||
|
The Elvis operator (`?`) means that the `employer` field is optional and if `undefined`, the rest of the expression should be ignored.
|
Loading…
x
Reference in New Issue
Block a user