File

src/app/drag-and-drop/drag-and-drop.component.ts

Implements

OnInit

Metadata

encapsulation ViewEncapsulation.None
selector app-drag-and-drop
styleUrls drag-and-drop.component.css
templateUrl ./drag-and-drop.component.html

Index

Properties
Methods

Constructor

constructor()

Methods

ngOnInit
ngOnInit()
Returns : void
onInc
onInc()
Returns : void

Properties

blah
blah:
Default value : 0
inc
inc:
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Subject } from 'rxjs/Subject';

@Component({
  selector: 'app-drag-and-drop',
  templateUrl: './drag-and-drop.component.html',
  styleUrls: ['./drag-and-drop.component.css'],
  encapsulation: ViewEncapsulation.None
})
export class DragAndDropComponent implements OnInit {
  inc = new Subject<number>();
  blah = 0;

  constructor() { }

  ngOnInit() {
  }

  onInc() {
    console.log('inc');
    this.blah++;
    this.inc.next();
  }
  

}
<p>
  This is still a work in progress.
</p>
<p>
    The drop location is calculated off of 
    the center of the element being dragged.
</p>
<p>
    Not the mouse cursor.
</p>
<button (click)="onInc()">Inc</button>
<foo [inc]="inc.asObservable() | async" [cnt]="blah"></foo>
<div >
    <ul uatDnDContainer>
        <li *uatDraggable style="padding: 14px; background-color: blue"><span>Item 1</span></li>
        <li *uatDraggable style="padding: 14px; background-color: green"><span>Item 2</span></li>
        <li *uatDraggable style="padding: 14px; background-color: yellow"><foo [inc]="inc.asObservable() | async" [cnt]="blah"></foo></li>
    </ul>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""