import { Directive , Host , Injectable , Input , OnInit , TemplateRef } from '@angular/core' ; @ Injectable ( ) export class STRowSource { private titles : { [ key ] : TemplateRef < void > ; } = { } ; private rows : { [ key ] : TemplateRef < void > ; } = { } ; add ( type , path , ref ) { this [ type === 'title' ? 'titles' : 'rows' ] [ path ] = ref ; } getTitle ( path ) { return this . titles [ path ] ; } getRow ( path ) { return this . rows [ path ] ; } } @ Directive ( { selector : '[st-row]' } ) export class STRowDirective implements OnInit { @ Input ( 'st-row' ) id ! : string ; @ Input ( ) type ? : 'title' ; constructor ( private ref , @ Host ( ) private source ) { } ngOnInit ( ) { this . source . add ( this . type , this . id , this . ref ) ; } }