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

textarea not manually resizable via resizeToFitContent method #2419

Closed
mark-langer opened this issue Dec 27, 2016 · 11 comments · Fixed by #2432
Closed

textarea not manually resizable via resizeToFitContent method #2419

mark-langer opened this issue Dec 27, 2016 · 11 comments · Fixed by #2432
Assignees

Comments

@mark-langer
Copy link

mark-langer commented Dec 27, 2016

Bug, feature request, or proposal:

Bug

What is the expected behavior?

According to the API, one should be able to call the method resizeToFitContent on the MdTextareaAutosize directive to manually trigger an auto-resize of the textarea that is labeled with md-autosize.

Since you have to declare a handle for the directive through a template variable, e. g. #myTextareaAutosizeDirective="mdTextareAutosize", to call any methods on it, the MdTextareaAutosize directive should have a decorator property exportAs defined.

What is the current behavior?

If you try to assign the directive to a template variable, an error is thrown. I assume this error occurs because of the directive's missing exportAs decorator property mentioned above.

The error reads: There is no directive with "exportAs" set to "mdTextareaAutosize"

What are the steps to reproduce?

This plunker shows the use case.

This plunker includes the template variable assignment that throws the error.

What is the use-case or motivation for changing an existing behavior?

In our app, we insert text into the textarea through a function which does not trigger the change event of the textarea that is normally used for resizing.

Which versions of Angular, Material, OS, browsers are affected?

beta.0

Is there anything else we should know?

Nope.

@devversion devversion self-assigned this Dec 27, 2016
devversion added a commit to devversion/material2 that referenced this issue Dec 27, 2016
devversion added a commit to devversion/material2 that referenced this issue Dec 27, 2016
devversion added a commit to devversion/material2 that referenced this issue Dec 28, 2016
devversion added a commit to devversion/material2 that referenced this issue Jan 4, 2017
@kara kara closed this as completed in #2432 Jan 4, 2017
kara pushed a commit that referenced this issue Jan 4, 2017
@szykov
Copy link

szykov commented Feb 11, 2017

Was it fixed? I tried plunkr and it still doesn't trigger a change event and textarea doesn't resize automatically when inserting value through the code. In my project the same behavior...

ps - also I noticed that plunkr isn't working when using md-input attribute but with mdInput works fine. Feature or bug? :)

@mark-langer
Copy link
Author

The fix has been published with beta.2 just yesterday.

@szykov
Copy link

szykov commented Feb 16, 2017

@mark-langer In the plunkr repo, autosize still isn't working with a new beta.2 release.
I forked your repo and updated md-input to mdInput:

http://plnkr.co/edit/JfAu98HL5faXM2LDuP8c?p=preview

@guojenman
Copy link

@szykov updated your plnkr with edits to make it work
http://plnkr.co/edit/w2qdyYJTtT6cg07MCZmU?p=preview

@szykov
Copy link

szykov commented Feb 17, 2017

@guojenman thanks for working example. I was expecting that it will trigger automatically resizing but manual call for resizeToFitContent is also fine. Thanks.

@guojenman
Copy link

guojenman commented Feb 17, 2017

@szykov Yeah, I was expecting that too. Maybe this directive needs to respond to ngModelChange event

Edit 1: was going to try to modify source but realized ngModelChange is out changes and what we want is in (programmatically) changes :/

@guojenman
Copy link

guojenman commented Feb 18, 2017

Edit 2: If DefaultValueAccessor could fire an event on writeValue, we can listen and to respond to this. Considering requesting this feature to @angular/forms but I want to see if there's another way first.

@szykov
Copy link

szykov commented Mar 23, 2017

@gucheen Grrr I found another bug related to this one. I updated plunkr repo:
http://plnkr.co/edit/6Od4nfkgoAT694nkYbgf?p=preview

This is a normal behaviour:
image

This is what happens if resize manually:
image

@devversion could you please reopen issue and help us? Thanks.

@sl007
Copy link

sl007 commented Jun 1, 2017

Iam using material 2.0.0-beta6 have same error: There is no directive with "exportAs" set to "mdTextareaAutosize"

@MatthewTrout
Copy link

Still not working beta 10..

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants