ItSolutionStuff.com

Angular Textarea Auto Height Example

By Hardik Savani • May 2, 2024
Angular

In this tute, we will discuss angular textarea autosize example. it's simple example of angular textarea auto height. We will use angular autosize textarea example. you can see autosize textarea in angular. You just need to some step to done angular textarea autosize directive.

you can set autosize of textarea in angular 6, angular 7, angular 8, angular 9, angular 10, angular 11, angular 12, angular 13, angular 14, angular 15, angular 16 and angular 17 version.

In this example, we will use ngx-autosize npm package to set auto height of textarea in angular app. we will take one textarea field and set autosize using ngx-autosize package.

So, let's see bellow step and get auto height textarea as like bellow screenshot:

Preview:

Step 1: Create New App

You can easily create your angular app using bellow command:

ng new myNewApp

Step 2: Install angularx-qrcode npm Package

Now in this step, we need to just install angularx-qrcode in our angular application. so let's add as like bellow:

npm install ngx-autosize

Step 3: Import AutosizeModule

we will import AutosizeModule module as like bellow code:

src/app/app.module.ts

import { BrowserModule } from '@angular/platform-browser';

import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

import {AutosizeModule} from 'ngx-autosize';

@NgModule({

declarations: [

AppComponent

],

imports: [

BrowserModule,

AutosizeModule

],

providers: [],

bootstrap: [AppComponent]

})

export class AppModule { }

Step 4: Update HTML File

here, we need to update html file as like bellow code:

src/app/app.component.html

<h1>Angular Autosize Textarea Example - ItSolutionStuff.com</h1>

<textarea autosize class="my-textarea">

Hello, this is an example of Autosize in Angular.

</textarea>

Now you can run by bellow command:

ng serve

now you can check it.

I hope it can help you...

Tags: Angular
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

Angular 11 CRUD Application Example

Read Now →

Angular Scroll to Top of Div Element Example

Read Now →

Angular Google Maps Get Current Location

Read Now →

Angular Material Copy to Clipboard Example

Read Now →

Angular Get Element By Id Value Example

Read Now →

How to Use Sweetalert2 in Angular?

Read Now →

Angular 9/8 Dropzone Image Upload Example

Read Now →

Angular Json Pipe Example | Json Pipe in Angular

Read Now →

Angular NgStyle Example | NgStyle Directive In Angular

Read Now →

Angular Http Post Request Example

Read Now →