Created
March 24, 2016 21:05
-
-
Save amahdy/0a70ad3f201453183e42 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
import {Directive, ViewContainerRef} from 'angular2/core'; | |
/* | |
* This directive aims to overcome the current issues in integrating vaadin-bar-chart to an Angular 2 app. | |
*/ | |
@Directive({ | |
selector: 'vaadin-bar-chart' | |
}) | |
export class VaadinBarChart { | |
constructor(public viewContainer: ViewContainerRef) { | |
const chart = viewContainer.element.nativeElement; | |
var selector = "vaadin-bar-chart"; | |
var localDoms = ["chart-title", "subtitle", "x-axis", "y-axis", "tooltip", "plot-options", "legend", "data-series"]; | |
for(var ld of localDoms) { | |
var localDom = chart.querySelector(ld + ":not(." + selector + ")"); | |
if (localDom) { | |
Polymer.dom(chart).appendChild(localDom); | |
} | |
} | |
chart.reloadConfiguration(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment