Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.94 KB | None | 0 0
  1. import {CommunityComponent} from './components/community.component';
  2. import {KayooModule} from './../kayoo/kayoo.module';
  3. import {PostModule} from './../post/post.module';
  4. import {NgModule} from '@angular/core';
  5. import {WallComponent} from './components/wall.component';
  6.  
  7. @NgModule(
  8. {
  9. declarations:[ WallComponent,
  10. CommunityComponent
  11. ],
  12. imports:[PostModule],
  13. entryComponents: [CommunityComponent],
  14. providers:[ComponentFactoryService],
  15. exports:[WallComponent]
  16. }
  17. )
  18. export class WallModule {}
  19.  
  20. import { Component, Input, ViewContainerRef, ViewChild } from "@angular/core";
  21. import { Base } from './../../kayoo/components/base';
  22.  
  23. @Component({
  24. selector : 'community',
  25. templateUrl : 'app/templates/community.component.html',
  26. styleUrls : ['app/templates/css/community.component.css'],
  27. })
  28.  
  29. export class CommunityComponent extends Base
  30. {
  31.  
  32. constructor()
  33. {
  34. super();
  35. }
  36.  
  37. public result=(data:any)=>
  38. {
  39. this.community=data;
  40. }
  41. }
  42.  
  43. import { CommunityComponent } from './community.component';
  44. import { ComponentFactoryService } from './../../services/services/component.fac';
  45. import { Component, Input,ViewChild,ViewContainerRef} from "@angular/core";
  46.  
  47. @Component({
  48. selector:'wall',
  49. templateUrl:'app/templates/wall.component.html',
  50. styleUrls:['app/templates/css/wall.component.css']
  51. })
  52.  
  53. export class WallComponent
  54. {
  55. @ViewChild('wallContent', {read: ViewContainerRef}) containerRef: ViewContainerRef;
  56.  
  57.  
  58. private com:{[id:string]:any;} =
  59. {
  60. "loadCommunity" : CommunityComponent
  61. };
  62.  
  63. private parameters : any;
  64.  
  65. constructor(private factory:ComponentFactoryService)
  66. {
  67.  
  68. }
  69.  
  70. }
  71.  
  72. import {Input,OnChanges,OnInit,ComponentRef} from "@angular/core";
  73.  
  74. export class Base
  75. {
  76.  
  77. @Input() parameters : any;
  78. @Input() ref : ComponentRef<any>;
  79. @Input() cfunc : any;
  80.  
  81.  
  82. getParameters() : any
  83. {
  84. return this.parameters;
  85. }
  86.  
  87. getRef() : ComponentRef<any>
  88. {
  89. return this.ref;
  90. }
  91.  
  92. getCFunc() : any
  93. {
  94. return this.cfunc;
  95. }
  96.  
  97. }
  98.  
  99. import { AsideModule } from '../../flayer/aside/aside.module';
  100. import { FooterModule } from '../../flayer/footer/footer.module';
  101. import { NavigationModule } from '../../flayer/navigation/navigation.module';
  102. import { HeaderModule } from '../../flayer/header/header.module';
  103. import { WallModule} from '../../flayer/wall/wall.module';
  104. import { ServicesModule } from '../../flayer/services/services.module';
  105. import { CoreService } from '../../core/services/core.service';
  106. import { NgModule } from '@angular/core';
  107. import { BrowserModule } from '@angular/platform-browser';
  108. import { HttpModule} from '@angular/http';
  109. import { CoreComponent } from './components/core.component';
  110.  
  111.  
  112. @NgModule({
  113. imports: [
  114. BrowserModule,
  115. HttpModule,
  116. HeaderModule,
  117. NavigationModule,
  118. WallModule,
  119. FooterModule,
  120. AsideModule,
  121. ServicesModule
  122. ],
  123. declarations: [CoreComponent],
  124. entryComponents:[],
  125. providers: [CoreService],
  126. bootstrap: [CoreComponent],
  127. exports: [CoreComponent]
  128.  
  129. })
  130. export class CoreModule { }
  131.  
  132. let factory = this.componentFactoryResolver.resolveComponentFactory(component);
  133. let injector = ReflectiveInjector.fromResolvedProviders([], refDOM.parentInjector);
  134. let comp = factory.create(injector);
  135. (<Base>comp.instance).parameters=parameters;
  136. (<Base>comp.instance).ref=comp;
  137. (<Base>comp.instance).cfunc=cfunc;
  138. comp.changeDetectorRef.detectChanges();
  139.  
  140. private com:{[id:string]:any;} =
  141. {
  142. "loadCommunity" : CommunityComponent
  143. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement