Skip to content

Instantly share code, notes, and snippets.

@yianni-ververis
Created May 7, 2018 12:50
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 yianni-ververis/bc5e1a8d5bbeef6db280540fa32d0637 to your computer and use it in GitHub Desktop.
Save yianni-ververis/bc5e1a8d5bbeef6db280540fa32d0637 to your computer and use it in GitHub Desktop.
Qdt-components - Angular 5 - Custom use of the Capability API methods
//https://help.qlik.com/en-US/sense-developer/April2018/Subsystems/APIs/Content/CapabilityAPIs/qlik-app-interface.htm
import { Component, OnInit, ElementRef, Input } from '@angular/core';
import * as QdtComponents from 'qdt-components';
let qConfig = {
"config": {
"host": "",
"secure": true,
"port": 443,
"prefix": "",
"appId": ""
},
"connections": {
"vizApi": true,
"engineApi": false
}
}
@Component({
selector: 'qdt-component',
templateUrl: './qdt-component.component.html',
styleUrls: ['./qdt-component.component.less']
})
export class QdtComponentComponent implements OnInit {
@Input() Component: string;
@Input() props: object;
static qdtComponent = new QdtComponents(qConfig.config, qConfig.connections);
constructor(private elementRef: ElementRef) { }
async ngOnInit() {
const qApp = await QdtComponentComponent.qdtComponent.qAppPromise;
qApp.clearAll();
console.log(qApp)
QdtComponentComponent.qdtComponent.render(this.Component, this.props, this.elementRef.nativeElement);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment