Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created September 2, 2020 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/04aca61fb016ba50fd877e058c31f39a to your computer and use it in GitHub Desktop.
Save bjoerntx/04aca61fb016ba50fd877e058c31f39a to your computer and use it in GitHub Desktop.
import { Component, HostListener } from '@angular/core';
declare const TXTextControl: any;
declare const loadDocument: any;
declare const loadJsonData: any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
// attach the txDocumentEditorLoaded event in the @HostListener decorator
// https://angular.io/api/core/HostListener
@HostListener('document:txDocumentEditorLoaded', ['$event'])
onTxDocumentEditorLoaded() {
var jsonData = '[{"Id":1,"Name":"Invoice","Orders":[{"Id":1,"OrderItems":[{"Id":1,"Qty":5,"Product":{"Id":1,"Name":"TX Spell .NET","Description":"Spell checking component","Available":true,"Price":249.56,"Serial":"AA6765653"},"Price":200.56},{"Price":4433.44}]}]}]';
// wait until TXTextControl has been loaded
TXTextControl.addEventListener("ribbonTabsLoaded", function() {
loadJsonData(jsonData);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment