import { Component, ViewChild, ElementRef } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { @ViewChild('mainDemoContainer') mainDemoContainer: ElementRef; showWindowButtonClick(): void { let windows = document.getElementsByClassName('jqx-window'), count = windows.length; while (count) { count -= 1; ($('#' + windows[count].id)).jqxWindow('open'); } } count: number = 0; addWindowButtonClick(): void { this.count += 1; //let mainDemoContainer = document.getElementById('mainDemoContainer'); let widgetContainer = document.createElement('div'); //let widgetContainer = '
'; //this.mainDemoContainer.nativeElement.appendChild(widgetContainer); this.mainDemoContainer.nativeElement.appendChild(widgetContainer); let newWindow = document.createElement('div'); let currentWindowID = 'windowNew' + this.count newWindow.id = currentWindowID; newWindow.innerHTML = '
Header ' + this.count + '
' + '
Content of window ' + this.count + '
'; widgetContainer.appendChild(newWindow); jqwidgets.createInstance('#' + currentWindowID, 'jqxWindow', { theme: 'material', height: 150, width: 300 }); } }