Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Created March 21, 2017 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NetanelBasal/84c300d130a8c675d97cad994d792bd7 to your computer and use it in GitHub Desktop.
Save NetanelBasal/84c300d130a8c675d97cad994d792bd7 to your computer and use it in GitHub Desktop.
@Directive({
selector: '[range]'
})
export class RangeDirective {
_range: number[];
@Input()
set range( value ) {
this.vcr.clear();
this._range = this.generateRange(value[0], value[1]);
this._range.forEach(num => {
this.vcr.createEmbeddedView(this.tpl, {
$implicit: num
});
});
}
constructor( private vcr : ViewContainerRef, private tpl : TemplateRef<any> ) {}
private generateRange( from, to ) {
// create range
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment