Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import { Component, OnInit, OnDestroy } from
  2. '@angular/core';
  3. import { DragulaService } from 'ng2-dragula';
  4. import { Subscription } from 'rxjs';
  5.  
  6. @Component({
  7. selector: 'app-images',
  8. templateUrl: './images.component.html',
  9. styleUrls: ['./images.component.scss']
  10. })
  11.  
  12. export class ImagesComponent implements OnInit, OnDestroy {
  13. subs = new Subscription();
  14.  
  15. constructor(
  16. private notifyService: NotifyService,
  17. private propertiesService: PropertiesService,
  18. private dragulaService: DragulaService
  19. ) { }
  20. ngOnInit() {
  21. this.subs.add(this.dragulaService.drop('images')
  22. .subscribe(({ name, el, target, source, sibling }) => {
  23. // fire a save function to update new array order
  24. })
  25. );
  26. }
  27. ngOnDestroy() {
  28. // destroy all the subscriptions at once
  29. this.subs.unsubscribe();
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement