@@ -8,7 +8,7 @@ import {DEFAULT} from 'angular2/change_detection';
88/**
99 * Directives allow you to attach behavior to elements in the DOM.
1010 *
11- * Directive is an abstract concept, instead use concrete directives: {@link Component}, { @link DynamicComponent}, {@link Decorator}.
11+ * Directive is an abstract concept, instead use concrete directives: {@link Component}, or {@link Decorator}.
1212 *
1313 * A directive consists of a single directive annotation and a controller class. When the directive's `selector` matches
1414 * elements in the DOM, the following steps occur:
@@ -542,6 +542,51 @@ export class Directive extends Injectable {
542542 * }
543543 * ```
544544 *
545+ *
546+ * Dynamically loading a component at runtime:
547+ *
548+ * Regular Angular components are statically resolved. Dynamic components allows to resolve a component at runtime
549+ * instead by providing a placeholder into which a regular Angular component can be dynamically loaded. Once loaded,
550+ * the dynamically-loaded component becomes permanent and cannot be changed.
551+ * Dynamic components are declared just like components, but without a `@View` annotation.
552+ *
553+ *
554+ * ## Example
555+ *
556+ * Here we have `DynamicComp` which acts as the placeholder for `HelloCmp`. At runtime, the dynamic component
557+ * `DynamicComp` requests loading of the `HelloCmp` component.
558+ *
559+ * There is nothing special about `HelloCmp`, which is a regular Angular component. It can also be used in other static
560+ * locations.
561+ *
562+ * ```
563+ * @Component ({
564+ * selector: 'dynamic-comp'
565+ * })
566+ * class DynamicComp {
567+ * helloCmp:HelloCmp;
568+ * constructor(loader:DynamicComponentLoader, location:ElementRef) {
569+ * loader.load(HelloCmp, location).then((helloCmp) => {
570+ * this.helloCmp = helloCmp;
571+ * });
572+ * }
573+ * }
574+ *
575+ * @Component ({
576+ * selector: 'hello-cmp'
577+ * })
578+ * @View ({
579+ * template: "{{greeting}}"
580+ * })
581+ * class HelloCmp {
582+ * greeting:string;
583+ * constructor() {
584+ * this.greeting = "hello";
585+ * }
586+ * }
587+ * ```
588+ *
589+ *
545590 * @exportedAs angular2/annotations
546591 */
547592export class Component extends Directive {
@@ -639,90 +684,6 @@ export class Component extends Directive {
639684 }
640685}
641686
642- /**
643- * Directive used for dynamically loading components.
644- *
645- * Regular Angular components are statically resolved. DynamicComponent allows to you resolve a component at runtime
646- * instead by providing a placeholder into which a regular Angular component can be dynamically loaded. Once loaded,
647- * the dynamically-loaded component becomes permanent and cannot be changed.
648- *
649- *
650- * ## Example
651- *
652- * Here we have `DynamicComp` which acts as the placeholder for `HelloCmp`. At runtime, the dynamic component
653- * `DynamicComp` requests loading of the `HelloCmp` component.
654- *
655- * There is nothing special about `HelloCmp`, which is a regular Angular component. It can also be used in other static
656- * locations.
657- *
658- * ```
659- * @DynamicComponent ({
660- * selector: 'dynamic-comp'
661- * })
662- * class DynamicComp {
663- * helloCmp:HelloCmp;
664- * constructor(loader:DynamicComponentLoader, location:PrivateComponentLocation) {
665- * loader.load(HelloCmp, location).then((helloCmp) => {
666- * this.helloCmp = helloCmp;
667- * });
668- * }
669- * }
670- *
671- * @Component ({
672- * selector: 'hello-cmp'
673- * })
674- * @View ({
675- * template: "{{greeting}}"
676- * })
677- * class HelloCmp {
678- * greeting:string;
679- * constructor() {
680- * this.greeting = "hello";
681- * }
682- * }
683- * ```
684- *
685- *
686- *
687- * @exportedAs angular2/annotations
688- */
689- export class DynamicComponent extends Directive {
690- /**
691- * Same as `injectables` in the {@link Component}.
692- */
693- // TODO(vsankin): Please extract into AbstractComponent
694- injectables :any ; //List;
695-
696- @CONST ( )
697- constructor ( {
698- selector,
699- properties,
700- events,
701- hostListeners,
702- hostProperties,
703- injectables,
704- lifecycle
705- } :{
706- selector :string ,
707- properties :any ,
708- events :List ,
709- hostListeners :any ,
710- hostProperties :any ,
711- injectables :List ,
712- lifecycle :List
713- } = { } ) {
714- super ( {
715- selector : selector ,
716- properties : properties ,
717- events : events ,
718- hostListeners : hostListeners ,
719- hostProperties : hostProperties ,
720- lifecycle : lifecycle
721- } ) ;
722-
723- this . injectables = injectables ;
724- }
725- }
726687
727688/**
728689 * Directive that attaches behavior to DOM elements.
0 commit comments