@supermemo/ng2-dragula
Version:
Simple drag and drop with dragula
44 lines (39 loc) • 1.16 kB
text/typescript
import { Component, Input, ViewChild, ElementRef } from "@angular/core";
import { BehaviorSubject } from 'rxjs';
import { DragulaDirective } from '../components/dragula.directive';
export class TestHostComponent {
group = "GROUP";
// don't give model a default value
// because the Asynchronous subclass setter would get called
model: any[];
host: ElementRef<HTMLDivElement>;
directive: DragulaDirective;
modelChange(newModel: any[]) {
this.model = newModel;
}
}
export class TwoWay extends TestHostComponent { }
export class Asynchronous extends TestHostComponent {
model$ = new BehaviorSubject<any[]>([]);
set model(neu: any[]) {
this.model$.next(neu);
}
}