angular2-draggable
angular2-draggable copied to clipboard
resetSize() method not getting height of div correctly
Firstly I have to thank you for this useful library.
I have a div like this
<div #resizeableDiv="ngResizable" [ngResizable]="isResizeable" [ngClass]="{'draggable-content': isResizeable}">
inside div
, there is a button to change the boolean variable isResizeable
.
<a href="#" (click)="resetDiv(resizeableDiv)">...</a>
here is resetDiv
function
resetDiv(block: AngularResizableDirective) {
this.isResizeable= !this.isResizeable;
if (!this.isResizeable) {
block.resetSize();
}
}
isResizeable
is false by default, so when I click for the second time it will call the function resetSize()
. On the first call, it seems like it is OK. But at the second call, it does not resize the div to its original size.
When I debug inside resetSize()
function I see that _initSize
have height:17
which is WRONG!.
I have a bunch of ngIf
statements inside resizeableDiv
I think this might be the reason. I'm not sure how it seems like working at the first call to the function resetSize()
For the record, I solved my problem by setting the size of HTML element manually using JS