docs(cheatsheet): add NgModules docs to the cheatsheet
This commit is contained in:
parent
d21331e902
commit
d1f4222c83
|
@ -95,7 +95,7 @@ export function createPlatform(injector: Injector): PlatformRef {
|
||||||
export type PlatformFactory = (extraProviders?: any[]) => PlatformRef;
|
export type PlatformFactory = (extraProviders?: any[]) => PlatformRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a fatory for a platform
|
* Creates a factory for a platform
|
||||||
*
|
*
|
||||||
* @experimental APIs related to application bootstrap are currently under review.
|
* @experimental APIs related to application bootstrap are currently under review.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,17 +2,15 @@
|
||||||
Bootstrapping
|
Bootstrapping
|
||||||
@cheatsheetIndex 0
|
@cheatsheetIndex 0
|
||||||
@description
|
@description
|
||||||
{@target ts}`import { bootstrap } from '@angular/platform-browser-dynamic';`{@endtarget}
|
{@target ts}`import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';`{@endtarget}
|
||||||
{@target js}Available from the `ng.platform.browser` namespace{@endtarget}
|
{@target js}Available from the `ng.platformBrowser` namespace{@endtarget}
|
||||||
{@target dart}`import 'package:angular2/platform/browser.dart';`{@endtarget}
|
{@target dart}`import 'package:angular2/platform/browser.dart';`{@endtarget}
|
||||||
|
|
||||||
@cheatsheetItem
|
@cheatsheetItem
|
||||||
syntax(ts dart):
|
syntax(ts dart):
|
||||||
`bootstrap(MyAppComponent, [MyService, { provide: ... }]);`|`provide`
|
`platformBrowserDynamic().bootstrapModule(MyAppModule);`|`platformBrowserDynamic().bootstrapModule`
|
||||||
syntax(js):
|
syntax(js):
|
||||||
`document.addEventListener('DOMContentLoaded', function () {
|
`document.addEventListener('DOMContentLoaded', function () {
|
||||||
ng.platform.browser.bootstrap(MyAppComponent,
|
ng.platformBrowser.platformBrowserDynamic().bootstrapModuleDynamic(MyAppModule);`|`platformBrowserDynamic().bootstrapModule`
|
||||||
[MyService, { provide: ... }]);
|
|
||||||
});`|`provide`
|
|
||||||
description:
|
description:
|
||||||
Bootstraps an application with MyAppComponent as the root component and configures the DI providers. {@target js}Must be wrapped in the event listener to fire when the page loads.{@endtarget}
|
Bootstraps an application defined as MyAppModule ng module using the Just in Time compiler.{@target js}Must be wrapped in the event listener to fire when the page loads.{@endtarget}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Built-in directives
|
Built-in directives
|
||||||
@cheatsheetIndex 2
|
@cheatsheetIndex 3
|
||||||
@description
|
@description
|
||||||
{@target ts}`import {NgIf, ...} from '@angular/common';`{@endtarget}
|
{@target ts}`import {NgIf, ...} from '@angular/common';`{@endtarget}
|
||||||
{@target js}Available from the `ng.common` namespace{@endtarget}
|
{@target js}Available from the `ng.common` namespace{@endtarget}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Class decorators
|
Class decorators
|
||||||
@cheatsheetIndex 4
|
@cheatsheetIndex 5
|
||||||
@description
|
@description
|
||||||
{@target ts}`import {Directive, ...} from '@angular/core';`{@endtarget}
|
{@target ts}`import {Directive, ...} from '@angular/core';`{@endtarget}
|
||||||
{@target js}Available from the `ng.core` namespace{@endtarget}
|
{@target js}Available from the `ng.core` namespace{@endtarget}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Component configuration
|
Component configuration
|
||||||
@cheatsheetIndex 6
|
@cheatsheetIndex 7
|
||||||
@description
|
@description
|
||||||
{@target js}`ng.core.Component` extends `ng.core.Directive`,
|
{@target js}`ng.core.Component` extends `ng.core.Directive`,
|
||||||
so the `ng.core.Directive` configuration applies to components as well{@endtarget}
|
so the `ng.core.Directive` configuration applies to components as well{@endtarget}
|
||||||
|
@ -36,17 +36,3 @@ syntax:
|
||||||
styleUrls: ['my-component.css']`|`styles:`|`styleUrls:`
|
styleUrls: ['my-component.css']`|`styles:`|`styleUrls:`
|
||||||
description:
|
description:
|
||||||
List of inline CSS styles / external stylesheet URLs for styling component’s view.
|
List of inline CSS styles / external stylesheet URLs for styling component’s view.
|
||||||
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
syntax:
|
|
||||||
`directives: [MyDirective, MyComponent]`|`directives:`
|
|
||||||
description:
|
|
||||||
List of directives used in the the component’s template.
|
|
||||||
|
|
||||||
|
|
||||||
@cheatsheetItem
|
|
||||||
syntax:
|
|
||||||
`pipes: [MyPipe, OtherPipe]`|`pipes:`
|
|
||||||
description:
|
|
||||||
List of pipes used in the component's template.
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Dependency injection configuration
|
Dependency injection configuration
|
||||||
@cheatsheetIndex 9
|
@cheatsheetIndex 10
|
||||||
@description
|
@description
|
||||||
{@target dart}`import 'package:angular2/core.dart';`{@endtarget}
|
{@target dart}`import 'package:angular2/core.dart';`{@endtarget}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Class field decorators for directives and components
|
Class field decorators for directives and components
|
||||||
@cheatsheetIndex 7
|
@cheatsheetIndex 8
|
||||||
@description
|
@description
|
||||||
{@target ts}`import {Input, ...} from '@angular/core';`{@endtarget}
|
{@target ts}`import {Input, ...} from '@angular/core';`{@endtarget}
|
||||||
{@target js}Available from the `ng.core` namespace{@endtarget}
|
{@target js}Available from the `ng.core` namespace{@endtarget}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Directive configuration
|
Directive configuration
|
||||||
@cheatsheetIndex 5
|
@cheatsheetIndex 6
|
||||||
@description
|
@description
|
||||||
{@target ts}`@Directive({ property1: value1, ... })`{@endtarget}
|
{@target ts}`@Directive({ property1: value1, ... })`{@endtarget}
|
||||||
{@target js}`ng.core.Directive({ property1: value1, ... }).Class({...})`{@endtarget}
|
{@target js}`ng.core.Directive({ property1: value1, ... }).Class({...})`{@endtarget}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Forms
|
Forms
|
||||||
@cheatsheetIndex 3
|
@cheatsheetIndex 4
|
||||||
@description
|
@description
|
||||||
{@target ts}`import {FORM_DIRECTIVES} from '@angular/common';`{@endtarget}
|
{@target ts}`import {FormsModule} from '@angular/forms';`{@endtarget}
|
||||||
{@target js}Available from `ng.common.FORM_DIRECTIVES`{@endtarget}
|
{@target js}Available from `ng.forms.FormsModule`{@endtarget}
|
||||||
{@target dart}Available using `platform_directives` in pubspec{@endtarget}
|
{@target dart}Available using `platform_directives` in pubspec{@endtarget}
|
||||||
|
|
||||||
@cheatsheetItem
|
@cheatsheetItem
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Directive and component change detection and lifecycle hooks
|
Directive and component change detection and lifecycle hooks
|
||||||
@cheatsheetIndex 8
|
@cheatsheetIndex 9
|
||||||
@description
|
@description
|
||||||
{@target ts dart}(implemented as class methods){@endtarget}
|
{@target ts dart}(implemented as class methods){@endtarget}
|
||||||
{@target js}(implemented as component properties){@endtarget}
|
{@target js}(implemented as component properties){@endtarget}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
@cheatsheetSection
|
||||||
|
NgModules
|
||||||
|
@cheatsheetIndex 1
|
||||||
|
@description
|
||||||
|
{@target ts js}`import { NgModule } from '@angular/core';`{@endtarget}
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
syntax(ts js):
|
||||||
|
`@NgModule({ declarations: ... , imports: ..., exports: ..., bootstrap: ...})
|
||||||
|
class MyModule {}`|`NgModule`
|
||||||
|
description:
|
||||||
|
Defines a module that contains components, directives, pipes and providers.
|
||||||
|
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
syntax(ts js):
|
||||||
|
`declarations: [MyRedComponent, MyBlueComponent, MyDatePipe]`|`declarations:`
|
||||||
|
description:
|
||||||
|
List of components, directives and pipes that belong to this module.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
syntax(ts js):
|
||||||
|
`imports: [BrowserModule, SomeOtherModule]`|`imports:`
|
||||||
|
description:
|
||||||
|
List of modules that are being imported into this module. Everything from the imported modules will
|
||||||
|
be available to `declarations` of this module.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
syntax(ts js):
|
||||||
|
`exports: [MyRedComponent, MyDatePipe]`|`exports:`
|
||||||
|
description:
|
||||||
|
List of components, directives and pipes that will be visible to modules that import this module.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
syntax(ts js):
|
||||||
|
`providers: [MyService, { provide: ... }]`|`providers:`
|
||||||
|
description:
|
||||||
|
Array of dependency injection providers visible to contents of this module as well as everyone
|
||||||
|
importing this module.
|
||||||
|
|
||||||
|
@cheatsheetItem
|
||||||
|
syntax(ts js):
|
||||||
|
`bootstrap: [MyAppComponent]`|`bootstrap:`
|
||||||
|
description:
|
||||||
|
Array of components to bootstrap when this module is bootstrapped.
|
|
@ -1,6 +1,6 @@
|
||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Routing and navigation
|
Routing and navigation
|
||||||
@cheatsheetIndex 10
|
@cheatsheetIndex 11
|
||||||
@description
|
@description
|
||||||
{@target ts}`import {provideRouter, RouteConfig, ROUTER_DIRECTIVES, ...} from '@angular/router';`{@endtarget}
|
{@target ts}`import {provideRouter, RouteConfig, ROUTER_DIRECTIVES, ...} from '@angular/router';`{@endtarget}
|
||||||
{@target js}Available from the `ng.router` namespace{@endtarget}
|
{@target js}Available from the `ng.router` namespace{@endtarget}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@cheatsheetSection
|
@cheatsheetSection
|
||||||
Template syntax
|
Template syntax
|
||||||
@cheatsheetIndex 1
|
@cheatsheetIndex 2
|
||||||
@description
|
@description
|
||||||
|
|
||||||
@cheatsheetItem
|
@cheatsheetItem
|
||||||
|
|
Loading…
Reference in New Issue