This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class Ng2FrameworkComponentWrapper extends ... { | |
| ... | |
| public createComponent<T>(componentType: { new(...args: any[]): T; }): ComponentRef<T> { | |
| let factory = this.componentFactoryResolver.resolveComponentFactory(componentType); | |
| return this.viewContainerRef.createComponent(factory); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseGuiComponent { | |
| protected init(params: P): void { | |
| this._params = params; | |
| this._componentRef = this.createComponent(); | |
| this._agAwareComponent = this._componentRef.instance; | |
| this._frameworkComponentInstance = this._componentRef.instance; | |
| this._eGui = this._componentRef.location.nativeElement; | |
| this._agAwareComponent.agInit(this._params); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component({ | |
| selector: 'ag-grid-angular', | |
| ... | |
| }) | |
| export class AgGridNg2 implements AfterViewInit { | |
| ... | |
| constructor(private viewContainerRef: ViewContainerRef, | |
| private frameworkComponentWrapper: Ng2FrameworkComponentWrapper, | |
| private _componentFactoryResolver: ComponentFactoryResolver, ...) { | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseGuiComponent { | |
| protected init(params: P): void { ... } | |
| public getGui(): HTMLElement { | |
| return this._eGui; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseGuiComponent { | |
| protected init(params: P): void { | |
| this._params = params; | |
| this._componentRef = this.createComponent(); | |
| this._agAwareComponent = this._componentRef.instance; | |
| this._frameworkComponentInstance = this._componentRef.instance; | |
| this._eGui = this._componentRef.location.nativeElement; | |
| this._agAwareComponent.agInit(this._params); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DynamicAgNg2Component extends BaseGuiComponent { | |
| init(params) { | |
| _super.prototype.init.call(this, params); | |
| this._componentRef.changeDetectorRef.detectChanges(); | |
| }; | |
| ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DynamicAgNg2Component extends BaseGuiComponent { | |
| init(params) { | |
| _super.prototype.init.call(this, params); | |
| this._componentRef.changeDetectorRef.detectChanges(); | |
| }; | |
| ... | |
| } | |
| class BaseGuiComponent { | |
| protected init(params: P): void { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseGuiComponent { | |
| protected init(params: P): void { | |
| this._params = params; | |
| this._componentRef = this.createComponent(); | |
| this._agAwareComponent = this._componentRef.instance; | |
| this._frameworkComponentInstance = this._componentRef.instance; | |
| this._eGui = this._componentRef.location.nativeElement; | |
| this._agAwareComponent.agInit(this._params); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component({ | |
| selector: 'app-number-formatter-cell', | |
| template: ` | |
| <span>{{params.value | currency:'EUR'}}</span> | |
| ` | |
| }) | |
| export class NumberFormatterComponent { | |
| params: any; | |
| agInit(params: any): void { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NumberCellFormatter { | |
| init(params) { | |
| const text = params.value.toLocaleString(undefined, {style: 'currency', currency: 'EUR'}); | |
| this.eGui = document.createElement('span'); | |
| this.eGui.innerHTML = text; | |
| } | |
| getGui() { | |
| return this.eGui; |