Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resetSize() method not getting height of div correctly #196

Open
canbax opened this issue Dec 13, 2019 · 1 comment
Open

resetSize() method not getting height of div correctly #196

canbax opened this issue Dec 13, 2019 · 1 comment

Comments

@canbax
Copy link

canbax commented Dec 13, 2019

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.

XMlO15XBtQ

When I debug inside resetSize() function I see that _initSize have height:17 which is WRONG!.
chrome_ZmYm5bylU0

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()

@canbax
Copy link
Author

canbax commented Feb 14, 2020

For the record, I solved my problem by setting the size of HTML element manually using JS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant