How do I get the specific HTML dom element passed through a binding. Sorry if this is hard to understand, here's the code.
donut-chart.html
<div class="donut-chart" (donut)="$element"></div>
How do I pass the div element to donut?
This is the TS
dount-chart.ts
@Component({
selector: 'donut-chart',
template: require('./donut-chart.html'),
directives: [Widget, MorrisChart],
encapsulation: ViewEncapsulation.None,
styles: [require('./donut-chart.scss')]
})
export class DonutChart implements OnChanges{
@Input() height: number = 300;
@Input() data: any[] = [{label: 'loading', value: '0', color: '#eee'}];
morris3Options: any;
donut: any;
render(): void {
jQuery(this.donut).css({height: this.height}); // safari svg height fix
window['Morris']['Donut']({element: this.donut}, this.morris3Options);
}
I want the donut variable to be the element without using class/id. I need to use multiple donuts and jQuery, so I need a way to get the unique donut.
<div #someElement></div>
<div class="donut-chart" (donut)="someElement"></div>
it can also be the current element
<div #someElement class="donut-chart" (donut)="someElement"></div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With