Thursday, August 18, 2022
Angular 8Angular 9MaterialAngular

Angular 9 Material input fields working example

Angular 9 Material input fields working example

Hello to all, welcome on In this post, I will tell you, Angular 9 Material input fields working example.

Angular 9 Material input fields working example
Angular 9 Material input fields working example

Post Working:

In this post, I am showing Angular material input fields with proper styling and animation.

Here is the complete working code snippet and please follow carefully:

1. Here are some basics commands which will help you to install Angular 9 setup on your machine:

$ npm install -g @angular/cli //Setup Angular9 atmosphere

$ ng new angularlatest9 //Install New Angular App

/**You need to update your Nodejs also for this verison**/

$ cd angularlatest9 //Go inside the Angular 9 Project


2. Now here are the commands to install Angular Material modules on your Angular 9 setup:

npm install --save @angular/material

npm install --save @angular/cdk


3. Now you need to add below code into your app.module.ts file:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { MatFormFieldModule } from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
import { AppComponent } from './app.component';
import {MatSelectModule} from '@angular/material/select';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

  declarations: [
  imports: [
  providers: [],
  bootstrap: [AppComponent]
export class AppModule { }


4. Now you need to add below code into your angular.json file:

"styles": [


5. Now you to add below code into your app.component.ts file:

<link href="" rel="stylesheet">
<div class="example-container">
  <mat-form-field appearance="fill">
    <input matInput>
  <mat-form-field appearance="fill">
      <mat-option value="option">Option</mat-option>
  <mat-form-field appearance="fill">
    <textarea matInput></textarea>
  <button mat-button>Click me!</button>


This is it and don’t forget to run ng serve command and check the output. If you have any kind of query then please do comment below.


Thank you

the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 7, Angular 8, Angular 9, Angular 10, Angular 11, Angular12, Angular 13, Angular 14, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.


  • Import Error in Angular 9 Version:-

    “import { MatFormFieldModule } from ‘@angular/material;”

    Solved by:-

    “import { MatFormFieldModule } from ‘@angular/material/form-field’;”

    I was having this error searched a lot

    Thank you man you saved my life

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.