11import {
2+ AfterContentChecked ,
23 Component ,
34 OnInit
45} from '@angular/core' ;
56
67import { AppState } from '../app.service' ;
78import { Title } from './title' ;
89import { XLargeDirective } from './x-large' ;
9- import { TableExport } from 'tableexport' ;
10+ import { TableExport } from 'tableexport' ;
1011
1112@Component ( {
1213 /**
@@ -30,11 +31,35 @@ import {TableExport} from 'tableexport';
3031 */
3132 templateUrl : './home.component.html'
3233} )
33- export class HomeComponent implements OnInit {
34+ export class HomeComponent implements OnInit , AfterContentChecked {
3435 /**
3536 * Set our default values
3637 */
37- public localState = { value : '' } ;
38+ public localState = {
39+ value : '' ,
40+ data : [
41+ {
42+ name : 'Thor Walton' ,
43+ position : 'Regional Director' ,
44+ age : 45 ,
45+ salary : '$98,540'
46+ } ,
47+ {
48+ name : 'Travis Clarke' ,
49+ position : 'Software Engineer' ,
50+ age : 30 ,
51+ salary : '$275,000'
52+ } ,
53+ {
54+ name : 'Suki Burks' ,
55+ position : 'Office Manager' ,
56+ age : 22 ,
57+ salary : '$67,670'
58+ }
59+ ]
60+ } ;
61+
62+ public te : TableExport ;
3863 /**
3964 * TypeScript public modifiers
4065 */
@@ -50,10 +75,10 @@ export class HomeComponent implements OnInit {
5075 */
5176 }
5277
53- public ngAfterContentInit ( ) {
54- new TableExport ( document . querySelector ( '#default-table' ) , {
78+ public ngAfterContentChecked ( ) {
79+ this . te = new TableExport ( document . querySelector ( '#default-table' ) , {
5580 formats : [ 'xlsx' , 'xls' , 'csv' , 'txt' ]
56- } ) ;
81+ } ) . reset ( ) ;
5782 }
5883
5984 public submitState ( value : string ) {
0 commit comments