import { Component, OnInit ,Output,EventEmitter,ElementRef,Renderer2,ViewEncapsulation} from '@angular/core'; @Component({ selector: 'hudongba-detail-ctrl', templateUrl: './detail-ctrl.component.html', styleUrls: ['./detail-ctrl.component.scss'], encapsulation: ViewEncapsulation.None }) export class DetailCtrlComponent implements OnInit { @Output() onIndex: EventEmitter = new EventEmitter(); @Output() onTicket: EventEmitter = new EventEmitter(); constructor( public ele: ElementRef, public render: Renderer2 ) { this.render.addClass(this.ele.nativeElement,'box') } ngOnInit() { window['requirejs']([ "./assets/bower_components/alloytouch/alloy_touch.js", "./assets/bower_components/alloytouch/transformjs/transform.js", ],()=>{ window['Transform'](this.ele.nativeElement); new window['AlloyTouch']({ touch: this.ele.nativeElement, pressMove: (evt)=>{ this.ele.nativeElement['translateX'] += evt.deltaX; this.ele.nativeElement['translateY'] += evt.deltaY; } }) }) } _onTicket(){ this.onTicket.emit('onTicket') } _onIndex(){ this.onIndex.emit('onIndex') } }