doc(DynamicComponentLoader): update API doc

This commit is contained in:
Victor Berchet 2015-10-22 23:34:16 -07:00
parent d8b3601927
commit b90d899408
1 changed files with 25 additions and 49 deletions

View File

@ -106,36 +106,27 @@ export abstract class DynamicComponentLoader {
* *
* Returns a promise for the {@link ComponentRef} representing the newly created Component. * Returns a promise for the {@link ComponentRef} representing the newly created Component.
* *
*
* ### Example * ### Example
* *
* ``` * ```
* @ng.Component({ * @Component({
* selector: 'child-component' * selector: 'child-component',
* })
* @ng.View({
* template: 'Child' * template: 'Child'
* }) * })
* class ChildComponent { * class ChildComponent {
* } * }
* *
* * @Component({
* * selector: 'my-app',
* @ng.Component({ * template: 'Parent (<child id="child"></child>)'
* selector: 'my-app'
* })
* @ng.View({
* template: `
* Parent (<child id="child"></child>)
* `
* }) * })
* class MyApp { * class MyApp {
* constructor(dynamicComponentLoader: ng.DynamicComponentLoader, injector: ng.Injector) { * constructor(dcl: DynamicComponentLoader, injector: Injector) {
* dynamicComponentLoader.loadAsRoot(ChildComponent, '#child', injector); * dcl.loadAsRoot(ChildComponent, '#child', injector);
* } * }
* } * }
* *
* ng.bootstrap(MyApp); * bootstrap(MyApp);
* ``` * ```
* *
* Resulting DOM: * Resulting DOM:
@ -143,9 +134,7 @@ export abstract class DynamicComponentLoader {
* ``` * ```
* <my-app> * <my-app>
* Parent ( * Parent (
* <child id="child"> * <child id="child">Child</child>
* Child
* </child>
* ) * )
* </my-app> * </my-app>
* ``` * ```
@ -166,35 +155,27 @@ export abstract class DynamicComponentLoader {
* *
* Returns a promise for the {@link ComponentRef} representing the newly created Component. * Returns a promise for the {@link ComponentRef} representing the newly created Component.
* *
*
* ### Example * ### Example
* *
* ``` * ```
* @ng.Component({ * @Component({
* selector: 'child-component' * selector: 'child-component',
* })
* @ng.View({
* template: 'Child' * template: 'Child'
* }) * })
* class ChildComponent { * class ChildComponent {
* } * }
* *
* * @Component({
* @ng.Component({ * selector: 'my-app',
* selector: 'my-app' * template: 'Parent (<div #child></div>)'
* })
* @ng.View({
* template: `
* Parent (<div #child></div>)
* `
* }) * })
* class MyApp { * class MyApp {
* constructor(dynamicComponentLoader: ng.DynamicComponentLoader, elementRef: ng.ElementRef) { * constructor(dcl: DynamicComponentLoader, elementRef: ElementRef) {
* dynamicComponentLoader.loadIntoLocation(ChildComponent, elementRef, 'child'); * dcl.loadIntoLocation(ChildComponent, elementRef, 'child');
* } * }
* } * }
* *
* ng.bootstrap(MyApp); * bootstrap(MyApp);
* ``` * ```
* *
* Resulting DOM: * Resulting DOM:
@ -224,29 +205,24 @@ export abstract class DynamicComponentLoader {
* ### Example * ### Example
* *
* ``` * ```
* @ng.Component({ * @Component({
* selector: 'child-component' * selector: 'child-component',
* })
* @ng.View({
* template: 'Child' * template: 'Child'
* }) * })
* class ChildComponent { * class ChildComponent {
* } * }
* *
* * @Component({
* @ng.Component({ * selector: 'my-app',
* selector: 'my-app' * template: 'Parent'
* })
* @ng.View({
* template: `Parent`
* }) * })
* class MyApp { * class MyApp {
* constructor(dynamicComponentLoader: ng.DynamicComponentLoader, elementRef: ng.ElementRef) { * constructor(dcl: DynamicComponentLoader, elementRef: ElementRef) {
* dynamicComponentLoader.loadNextToLocation(ChildComponent, elementRef); * dcl.loadNextToLocation(ChildComponent, elementRef);
* } * }
* } * }
* *
* ng.bootstrap(MyApp); * bootstrap(MyApp);
* ``` * ```
* *
* Resulting DOM: * Resulting DOM: