The method of using template to reference variables in ts file

  • description:
    angular6 "s UI suite
    uses a third-party UI library table component in the html file, and establishes a template reference variable for it:
    < p-table-sharpdt >

    . This table component has a method exportCSV () that can export the number of
    in the table as CSV. The original official example of
  • is to directly export data in the html file by calling the template reference variable method, without writing any code in the ts
    file, but now I can"t use the same official method for many reasons. Instead, I want to export the data in the
    ts file by calling the template reference variable method, so how should I write it?
  • I am angular novice, if the problem is too simple, please recommend an article, materials to see, if a little difficult
    hope to get some code for reference, thank you very much for your reply.
  • if necessary:
    my Q: 409223171 . If necessary, you can add me as a friend, or send this Q email address directly
  • .
Sep.23,2021

ViewChild

import { Component, ViewChild, AfterViewInit } from '@angular/core';

//table
import { TableComponent } from 'PrimeNG'

@Component({
    selector: 'app-xxx',
    templateUrl: './xxx.component.html',
    styleUrls: ['./xxx.component.css']
})
export class XXXComponent implements AfterViewInit {

    //
    @ViewChild('dt') dt:TableComponent

    constructor() {}

    ngAfterViewInit(){
        //
        this.dt.exportCSV()
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b390eb-2c170.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b390eb-2c170.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?