import { Directive , ElementRef , Input } from '@angular/core' ; declare var jQuery ; @ Directive ( { selector : '[ng2-highstocks]' } ) export class Ng2Highstocks { jqEle : any ; chart : HighchartsChartObject ; constructor ( ele ) { this . jqEle = jQuery ( ele . nativeElement ) ; } @ Input ( 'ng2-highstocks' ) set options ( opt ) { if ( ! opt ) { console . log ( 'No valid options...' ) ; console . log ( opt ) ; return ; } if ( opt . series || opt . data ) { if ( this . chart ) { this . chart . destroy ( ) ; } this . chart = this . jqEle . highcharts ( 'StockChart' , opt ) ; } else { console . log ( 'No valid options...' ) ; console . dir ( opt ) ; } } }