Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit, OnDestroy } from
- '@angular/core';
- import { DragulaService } from 'ng2-dragula';
- import { Subscription } from 'rxjs';
- @Component({
- selector: 'app-images',
- templateUrl: './images.component.html',
- styleUrls: ['./images.component.scss']
- })
- export class ImagesComponent implements OnInit, OnDestroy {
- subs = new Subscription();
- constructor(
- private notifyService: NotifyService,
- private propertiesService: PropertiesService,
- private dragulaService: DragulaService
- ) { }
- ngOnInit() {
- this.subs.add(this.dragulaService.drop('images')
- .subscribe(({ name, el, target, source, sibling }) => {
- // fire a save function to update new array order
- })
- );
- }
- ngOnDestroy() {
- // destroy all the subscriptions at once
- this.subs.unsubscribe();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement