docs(*): add initial cheatsheet tags

This commit is contained in:
Peter Bacon Darwin 2015-11-04 17:37:16 +00:00 committed by Naomi Black
parent d29563fdd3
commit 029c0534f3
2 changed files with 78 additions and 0 deletions

View File

@ -44,6 +44,29 @@ import {NgSwitch, NgSwitchWhen, NgSwitchDefault} from './ng_switch';
* ...
* }
* ```
* @cheatsheetSection
* Built-in directives
* `import {NgIf, ...} from 'angular2/angular2';`
* @cheatsheetItem
* <section *ng-if="showSection">
* Removes or recreates a portion of the DOM tree based on the showSection expression.
* *ng-if
* @cheatsheetItem
* <li *ng-for="#item of list">
* Turns the li element and its contents into a template, and uses that to instantiate a view for each item in list.
* '*ng-for'
* @cheatsheetItem
* <div [ng-switch]="conditionExpression">\n <template [ng-switch-when]="case1Exp">...</template>\n <template ng-switch-when="case2LiteralString">...</template>\n <template ng-switch-default>...</template>\n</div>
* Conditionally swaps the contents of the div by selecting one of the embedded templates based on the current value of conditionExpression.
* [ng-switch]
* [ng-switch-when]
* ng-switch-when
* ng-switch-default
* @cheatsheetItem
* <div [ng-class]="{active: isActive, disabled: isDisabled}">
* Binds the presence of css classes on the element to the truthiness of the associated map values. The right-hand side expression should return {class-name: true/false} map.
* [ng-class]
*/
export const CORE_DIRECTIVES: Type[] =
CONST_EXPR([NgClass, NgFor, NgIf, NgStyle, NgSwitch, NgSwitchWhen, NgSwitchDefault]);

View File

@ -18,6 +18,61 @@ export {
} from './application_ref';
/// See [commonBootstrap] for detailed documentation.
/**
* @cheatsheetSection
* Bootstrapping
* `import {bootstrap} from 'angular2/angular2';`
* @cheatsheetItem
* <input [value]="firstName">
* Binds property value to the result of expression firstName.
* [value]
* @cheatsheetItem
* <div [attr.role]="myAriaRole">
* Binds attribute role to the result of expression myAriaRole.
* [attr.role]
* @cheatsheetItem
* <div [class.extra-sparkle]="isDelightful">
* Binds the presence of the css class extra-sparkle on the element to the truthiness of the expression isDelightful.
* [class.extra-sparkle]
* @cheatsheetItem
* <div [style.width.px]="mySize">
* Binds style property width to the result of expression mySize in pixels. Units are optional.
* [style.width.px]
* @cheatsheetItem
* <button (click)="readRainbow($event)">
* Calls method readRainbow when a click event is triggered on this button element (or its children) and passes in the event object.
* (click)
* @cheatsheetItem
* <div title="Hello {{ponyName}}">
* Binds a property to an interpolated string, e.g. "Hello Seabiscuit". Equivalent to: <div [title]="'Hello' + ponyName">
* {{ponyName}}
* @cheatsheetItem
* <p>Hello {{ponyName}}</p>
* Binds text content to an interpolated string, e.g. "Hello Seabiscuit".
* {{ponyName}}
* @cheatsheetItem
* <my-cmp [(title)]="name">
* Sets up two-way data binding. Equivalent to:\n<my-cmp [title]="name" (title-change)="name=$event">
* [(title)]
* @cheatsheetItem
* <video #movieplayer ...>\n<button (click)="movieplayer.play()" >
* Creates a local variable movieplayer that provides access to the video element instance in data- and event-binding expressions in the current template.
* #movieplayer
* (click)
* @cheatsheetItem
* <p *my-unless="myExpression">...</p>
* The * symbol means that the current element will be turned into an embedded template. Equivalent to:\n<template [my-unless]="myExpression"><p>...</p></template>
* *my-unless
* @cheatsheetItem
* <p>Card No.: {{cardNumber myCreditCardNumberFormatter}}</p>
* Transforms the current value of expression cardNumber via pipe called creditCardNumberFormatter.
* {{cardNumber myCreditCardNumberFormatter}}
* @cheatsheetItem
* <p>Employer: {{employer?.companyName}}</p>
* The Elvis operator (?) means that the employer field is optional and if undefined, the rest of the expression should be ignored.
* {{employer?.companyName}}
*
*/
export function bootstrap(
appComponentType: /*Type*/ any,
appProviders: Array<Type | Provider | any[]> = null): Promise<ComponentRef> {