1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Why is my mat-form-field not showing the label?

Discussão em 'Angular' iniciado por Jhosef Matheus, Maio 13, 2025.

  1. I'm using angular material to construct a page, i'm trying to use the mat-form-field component but the label is not working and i don't know why. Can somebody help me, since now thank you all.

    app.module.ts:

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

    import { AppRoutingModule } from './app-routing.module';
    import { AppComponent } from './app.component';
    import { SignInComponent } from './views/sign-in/sign-in.component';
    import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

    import { MatFormFieldModule } from "@angular/material/form-field";

    @NgModule({
    declarations: [
    AppComponent,
    SignInComponent
    ],
    imports: [
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    MatFormFieldModule
    ],
    providers: [],
    bootstrap: [AppComponent]
    })
    export class AppModule { }


    sign-in.component.ts:

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

    @Component({
    selector: 'app-sign-in',
    templateUrl: './sign-in.component.html',
    styleUrls: ['./sign-in.component.css']
    })
    export class SignInComponent {

    }


    sign-in.component.html:

    <form>
    <mat-form-field appearance="fill">
    <mat-label>Login</mat-label>
    <input matInput type="text">
    </mat-form-field>
    </form>

    Continue reading...

Compartilhe esta Página