#material angular input doesnt have any style

17 messages · Page 1 of 1 (latest)

hot fern
#

my input doesnt have any type of style, seems plain html

#
<p>
    <mat-form-field appearance="fill">
      <mat-label>Fill form field</mat-label>
      <input matInput placeholder="Placeholder">
      <mat-icon matSuffix>sentiment_very_satisfied</mat-icon>
      <mat-hint>Hint</mat-hint>
    </mat-form-field>
  </p>
  <p>
    <mat-form-field appearance="outline">
      <mat-label>Outline form field</mat-label>
      <input matInput placeholder="Placeholder">
      <mat-icon matSuffix>sentiment_very_satisfied</mat-icon>
      <mat-hint>Hint</mat-hint>
    </mat-form-field>
  </p>
raven acorn
#

Follow angular material guide for adding prebuilt themes.

hot fern
#

i have already tried but don't work the style

#

idk why

hot fern
raven acorn
#

It has nothing to do with modules.
How did you install the package?

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

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { AppBarComponent } from './app-bar/app-bar.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

//Material import
import {MatToolbarModule} from '@angular/material/toolbar'; 
import {MatIconModule} from '@angular/material/icon'; 
import {MatButtonModule} from '@angular/material/button';
import { HomepageComponent } from './homepage/homepage.component'; 
import { Routes } from '@angular/router';
import { AssistenzaComponent } from './assistenza/assistenza.component';
import {MatCard, MatCardModule} from '@angular/material/card';
import {ClipboardModule} from '@angular/cdk/clipboard';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import { MessageComponent } from './message/message.component';
import {MatFormFieldModule} from '@angular/material/form-field';
import { ReactiveFormsModule } from '@angular/forms';


@NgModule({
  
  declarations: [
    AppComponent,
    AppBarComponent,
    HomepageComponent,
    AssistenzaComponent,
    MessageComponent,
  ],
  
  imports: [
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    MatToolbarModule,
    MatIconModule,
    MatButtonModule,
    MatCardModule,
    MatSnackBarModule,
    MatFormFieldModule,
    ReactiveFormsModule,
    MatFormFieldModule,
    
    
    
    

    
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
hot fern
raven acorn
#

So, not with ng add?
That's why you should have been following the official docs.
As an alternative you can manually add the prebuilt theme scss to angular.json or to your style.scss.
Otherwise, re-install with ng add, it will not hram anyone.
https://material.angular.io/guide/getting-started

hot fern
#

ng add @angular/material, yes i have used this not npm

#

all other component is well styled

#

but input not have any style

raven acorn
#

Which theme are you using?

hot fern
#

indigo e pink

#

all other component are styled but input no

#

i can't understand this