An autosizing directive for textarea elements in Angular 4+ applications
npm install ng4-textbox-autosize
Add declaration to @NgModule:
import {AutosizeDirective} from 'ng4-textbox-autosize';
...
@NgModule({
declarations: [
AutosizeDirective
]
})
Use directly inside your HTML templates by adding the word 'autosize' to any textarea.
<textarea autosize>Textarea content blah blah</textarea>
Set either a minimum height:
<textarea autosize [minHeight]="60">Textarea content blah blah</textarea>
A maximum height:
<textarea autosize [maxHeight]="120">Textarea content blah blah</textarea>
Or both:
<textarea autosize [minHeight]="60" [maxHeight]="120">Textarea content blah blah</textarea>
This project is licenced under the MIT licence. See the LICENSE file for more info.