Created
March 21, 2017 20:48
-
-
Save NetanelBasal/84c300d130a8c675d97cad994d792bd7 to your computer and use it in GitHub Desktop.
This file contains 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: '[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