import {AfterViewInit, Component, ElementRef, Input, ViewChild} from "@angular/core"; import {ActivatedRoute} from "@angular/router"; import {SliderContainerComponent} from "./slider-container.component"; import {SliderItemComponent} from "./slider-item.component"; export interface Link { routerLink?: { commands: string[] | string, queryParams?: Object, fragment?: string, relativeTo?: ActivatedRoute } href?: string external?: boolean } @Component({ selector: 'slider-nav-item', template: `
` }) export class SliderNavItemComponent extends SliderItemComponent implements AfterViewInit { @Input() link: Link = null; @Input() start: number; active: boolean = false; container: SliderContainerComponent; background: string; @ViewChild('linkElement') linkElement: ElementRef; ngAfterViewInit() { if(this.linkElement) { this.linkElement.nativeElement.style.background = this.background; } } }