<!DOCTYPE html>
<html>

  <head>
    <base href="." />
    <title>angular playground</title>
    <link rel="stylesheet" href="style.css" />
    <link rel="stylesheet" href="https://unpkg.com/bootstrap@next/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="https://unpkg.com/@angular-generic-table/core@4.2.0/css/generic-table.min.css" />
    <script src="https://unpkg.com/tether/dist/js/tether.min.js"></script>
    <script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script>
    <script src="https://unpkg.com/zone.js/dist/zone.js"></script>
    <script src="https://unpkg.com/zone.js/dist/long-stack-trace-zone.js"></script>
    <script src="https://unpkg.com/reflect-metadata@0.1.3/Reflect.js"></script>
    <script src="https://unpkg.com/systemjs@0.19.31/dist/system.js"></script>
    <script src="config.js"></script>
    <script>
    System.import('app')
      .catch(console.error.bind(console));
  </script>
  </head>

  <body class="container-fluid my-4">
    <my-app>
    loading...
  </my-app>
  </body>

</html>
/* Styles go here */
td.checkbox-column input.selected {
  display: none;
}

.row-selected td.checkbox-column input.selected {
  display: inline-block;
}

.row-selected td.checkbox-column input.unselected {
  display: none;
}
### Angular Starter Plunker - Typescript
System.config({
  //use typescript for compilation
  transpiler: 'typescript',
  //typescript compiler options
  typescriptOptions: {
    emitDecoratorMetadata: true
  },
  paths: {
    'npm:': 'https://unpkg.com/'
  },
  //map tells the System loader where to look for things
  map: {
    
    'app': './src',
    'tether': 'npm:tether',
    '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
    '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
    '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
    '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
    '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
    '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
    '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
    '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
    '@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
    '@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
    '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
    
    '@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
    '@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
    '@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
    '@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
    '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
    '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
    '@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
    
    '@angular-generic-table/core': 'npm:@angular-generic-table/core/core.module.js',
    
    'rxjs': 'npm:rxjs',
    'typescript': 'npm:typescript@2.2.1/lib/typescript.js'
  },
  //packages defines our app package
  packages: {
    app: {
      main: './main.ts',
      defaultExtension: 'ts'
    },
    rxjs: {
      defaultExtension: 'js'
    }
  }
});
//main entry point
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app';

platformBrowserDynamic().bootstrapModule(AppModule)
//our root app component
import {Component, NgModule, VERSION} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
import {GenericTableModule, GtConfig} from '@angular-generic-table/core'

@Component({
  selector: 'my-app',
  template: `
    <div>
      <h2>Angular Generic Table - Basic setup</h2>
    </div>
    <div class="table-responsive">
      <generic-table [gtClasses]="'table-sm'"  [gtOptions]="{rowSelection:true}" #myTable [gtSettings]="configObject.settings" [gtFields]="configObject.fields" [(gtData)]="configObject.data"></generic-table>
    </div>
    <div class="text-center">
      <small><gt-table-info class="form-text text-muted mb-2" [genericTable]="myTable"></gt-table-info></small>
      <gt-pagination [gtClasses]="'pagination-sm justify-content-center'" [genericTable]="myTable"></gt-pagination>
    </div>
  `
})
export class App {
  
  public data: Array<rowData> = [];
  public configObject: GtConfig<rowData>;

  name:string;
  constructor() {
    this.name = `Angular! v${VERSION.full}`
    this.configObject = {
      settings: [{
        objectKey: 'id',
        sort: 'asc',
        sortOrder: 1,
        columnOrder: 0
      }, {
        objectKey: 'name',
        sort: 'asc',
        sortOrder: 0,
        columnOrder: 1
      }, {
        objectKey: 'lucky_number',
        sort: 'enable',
        columnOrder: 2,
        visible: true
      }, {
        objectKey: 'checkbox',
        columnOrder: 3,
      }],
      fields: [{
        name: 'Id',
        objectKey: 'id'
      }, {
        name: 'Name',
        objectKey: 'name'
      }, {
        name: 'Lucky number',
        objectKey: 'lucky_number'
      }, {
        name: '',
        objectKey: 'checkbox',
        value:()=>{ return ''},
        render: ()=>{return '<input class="selected" type="checkbox" checked><input class="unselected" type="checkbox">'}
      }],
      data: [{
        'id': 1,
        'name': 'Anna',
        'lucky_number': 63
      }, {
        'id': 2,
        'name': 'Julie',
        'lucky_number': 8
      }, {
        'id': 3,
        'name': 'Lillian',
        'lucky_number': 30
      }, {
        'id': 4,
        'name': 'Norma',
        'lucky_number': 13
      }, {
        'id': 5,
        'name': 'Ralph',
        'lucky_number': 28
      }, {
        'id': 6,
        'name': 'Benjamin',
        'lucky_number': 66
      }, {
        'id': 7,
        'name': 'George',
        'lucky_number': 66
      }, {
        'id': 8,
        'name': 'Ryan',
        'lucky_number': 65
      }, {
        'id': 9,
        'name': 'Martha',
        'lucky_number': 57
      }, {
        'id': 10,
        'name': 'Todd',
        'lucky_number': 65
      }, {
        'id': 11,
        'name': 'Norma',
        'lucky_number': 73
      }, {
        'id': 12,
        'name': 'Frank',
        'lucky_number': 27
      }, {
        'id': 13,
        'name': 'Kathryn',
        'lucky_number': 93
      }, {
        'id': 14,
        'name': 'Philip',
        'lucky_number': 63
      }, {
        'id': 15,
        'name': 'Ronald',
        'lucky_number': 89
      }, {
        'id': 16,
        'name': 'Joshua',
        'lucky_number': 18
      }, {
        'id': 17,
        'name': 'Phillip',
        'lucky_number': 16
      }, {
        'id': 18,
        'name': 'Susan',
        'lucky_number': 6
      }, {
        'id': 19,
        'name': 'Louise',
        'lucky_number': 52
      }, {
        'id': 20,
        'name': 'Gary',
        'lucky_number': 18
      }, {
        'id': 21,
        'name': 'Laura',
        'lucky_number': 9
      }, {
        'id': 22,
        'name': 'Tina',
        'lucky_number': 70
      }, {
        'id': 23,
        'name': 'Jesse',
        'lucky_number': 2
      }, {
        'id': 24,
        'name': 'Jessica',
        'lucky_number': 15
      }, {
        'id': 25,
        'name': 'Scott',
        'lucky_number': 38
      }, {
        'id': 26,
        'name': 'Michael',
        'lucky_number': 23
      }, {
        'id': 27,
        'name': 'Harold',
        'lucky_number': 66
      }, {
        'id': 28,
        'name': 'William',
        'lucky_number': 57
      }, {
        'id': 29,
        'name': 'Harry',
        'lucky_number': 14
      }, {
        'id': 30,
        'name': 'Dennis',
        'lucky_number': 9
      }]
    };
  }
}

@NgModule({
  imports: [ BrowserModule, GenericTableModule ],
  declarations: [ App ],
  bootstrap: [ App ]
})
export class AppModule {}