Last active
June 24, 2018 14:52
-
-
Save realtomaszkula/0e239a9c0b4a6643725bcdc4c9ba5d27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({ | |
selector: '[carousel]' | |
}) | |
export class CarouselDirective implements OnInit { | |
context: CarouselContext | null = null; | |
constructor( | |
private tpl: TemplateRef<CarouselContext>, | |
private vcr: ViewContainerRef | |
) {} | |
@Input('carouselFrom') images: string[]; | |
ngOnInit(): void { | |
this.context = { | |
$implicit: this.images[0], | |
}; | |
this.vcr.createEmbeddedView(this.tpl, this.context); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment