I have create a component that gets an array with table datas. Another component draws the tables. Then I get the innerHTML and put it into a tinyMCE.
This works really well in ng serve, but when I create a ng build --prod, the tables are empty and no data is available.
ngOnInit() {
    this.data = JSON.parse(JSON.stringify(this.data));
    this.tabledata = this.data.protocol;
    this.tinymceModel = "";
        setTimeout(() => {
            let root = document.querySelectorAll('[name="tabledatas"]')
            Object.values(root).forEach(elem => {
                let result = elem.innerHTML;
                    result = result.replace(/<!--.*-->/g,'')
                    result = result.replace(/\t|\n/g,'')
                    result = result.replace(/<tfoot>.*<\/tfoot>/g,'')
                this.tinymceModel = this.tinymceModel + result;
            })
        })
...
}
The code looks like this. I believed that the setTimeout will wait until data are available, but it doesn't seem to work properly. Where is my mistake or how can I ensure to proceed when table is finally drawn?
 
     
    