import { Directive, ElementRef, EventEmitter, Output } from '@angular/core';
import Sortable from 'sortablejs';




@Directive({
  selector: '[ngSortable]'
})
export class SortableDirective {
  @Output() onEnd = new EventEmitter<any>();

  sortable: Sortable


  constructor(private el: ElementRef) {
    this.sortable = Sortable.create(el.nativeElement as HTMLElement, {
      onEnd: (evt: any) => {
        this.onEnd.emit(evt);
      }
    });
  }

}
