import { AfterViewInit , Directive } from '@angular/core' ; import { StatsService } from './stats.service' ; @ Directive ( { selector : '[atft-stats-auto-show]' } ) export class StatsAutoShowDirective implements AfterViewInit { constructor ( private statsService ) { } ngAfterViewInit ( ) { this . statsService . create ( ) ; } }