xieziyu / angular2-draggable

Angular directive (for version >= 2.x ) that makes the DOM element draggable and resizable

Home Page:https://xieziyu.github.io/angular2-draggable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using drag and resize but struggling to save position and size.

scottheappey opened this issue · comments

Geting x=Nan & y=Nan

How do I write this so that if undefined don't use: [position]='{x: xitem.x, y:xitem.y}'

I managed to save the position. But I'm sure there is a better way to write this:

<div *ngIf="xitem.x" ngDraggable (endOffset)="onMoveEnd(xitem, $event)" [position]='{x: xitem.x, y:xitem.y}' ngResizable [rzHandles]="'n,e,s,w,se,sw,ne,nw'" (rzStop)="onResizeStop(xitem, $event)" id="pill" class="pill"> ....

and

<div *ngIf="!xitem.x" ngDraggable (endOffset)="onMoveEnd(xitem, $event)" ngResizable [rzHandles]="'n,e,s,w,se,sw,ne,nw'" (rzStop)="onResizeStop(xitem, $event)" id="pill" class="pill"> ....

Now I need to save the size and position after resizing ...