/** Angular Imports */ import { Component , OnInit , ViewChild } from '@angular/core' ; import { MatPaginator } from '@angular/material/paginator' ; import { MatSort } from '@angular/material/sort' ; import { MatTableDataSource } from '@angular/material/table' ; import { ActivatedRoute } from '@angular/router' ; /**
 * Templates component.
 */ @ Component ( { selector : 'mifosx-templates' , templateUrl : './templates.component.html' , styleUrls : [ './templates.component.scss' ] } ) export class TemplatesComponent implements OnInit { /** Templates data. */ templatesData : any ; /** Columns to be displayed in templates table. */ displayedColumns : string [ ] = [ 'entity' , 'type' , 'name' ] ; /** Data source for templates table. */ dataSource : MatTableDataSource < any > ; /** Paginator for templates table. */ @ ViewChild ( MatPaginator , { static : true } ) paginator : MatPaginator ; /** Sorter for templates table. */ @ ViewChild ( MatSort , { static : true } ) sort : MatSort ; param { ActivatedRoute } route constructor ( private route ) { this . route . data . subscribe ( ( data ) => { this . templatesData = data . templates ; } ) ; } param { string } filterValue applyFilter ( filterValue ) { this . dataSource . filter = filterValue . trim ( ) . toLowerCase ( ) ; } /**
     * Sets the templates table.
     */ ngOnInit ( ) { this . setTemplates ( ) ; } /**
     * Initializes the data source, paginator and sorter for templates table.
     */ setTemplates ( ) { this . dataSource = new MatTableDataSource ( this . templatesData ) ; this . dataSource . paginator = this . paginator ; this . dataSource . sort = this . sort ; } }