0

I'm a newbie in angular. I'm following the example in link to implement the expanding sections in my app. I have the following code. When I click on the input field, there are no underlines displayed.

The html code in my component:

  <mat-accordion class="example-headers-align">
<mat-expansion-panel>
  <mat-expansion-panel-header>
    <mat-panel-title>{{ SECTION_HEADER_GENERAL_TITLE }}</mat-panel-title>
    <mat-panel-description>
      <mat-icon>{{ SECTION_HEADER_GENERAL_ICON }}</mat-icon>
      {{ SECTION_HEADER_GENERAL_DESCRIPTION }}
    </mat-panel-description>
  </mat-expansion-panel-header>

  <mat-form-field appearance="fill"> 
    <mat-label>{{ GENERAL_FIELD_NAME_LABEL }}</mat-label>
    <input matInput >
  </mat-form-field></mat-expansion-panel>  </mat-accordion>

When I used 'Inspect Element' and check the div corresponding to the underline, it seems like it is disabled for some reason:

enter image description here

Below is the Image of the input field in firefox browser.

enter image description here

my component.scss file is empty, I dont have any css specific to the component.

app.module.ts:

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

import { AppRoutingModule } from './app-routing.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './components/main-app/app.component';
import { LoginComponent } from './components/login/login.component';
import { FlexLayoutModule } from "@angular/flex-layout";
import { LayoutModule } from '@angular/cdk/layout';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatButtonModule } from '@angular/material/button';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatIconModule } from '@angular/material/icon';
import { MatListModule } from '@angular/material/list';
import {MatCardModule} from '@angular/material/card';
import {MatTableModule} from '@angular/material/table';
import { RestService } from './service/rest-services/rest.service';
import { AppConstants } from './constants/app-constants';
import { HttpClientModule } from '@angular/common/http';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { DatepickerApiComponent } from './datepicker-api/datepicker-api.component';
import { MatNativeDateModule, MAT_DATE_LOCALE, MAT_DATE_FORMATS, DateAdapter } from '@angular/material/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppDateFormatAdapter, APP_DATE_FORMATS } from './datepicker-api/AppDateFormatAdapter';
import { MatTabsModule } from '@angular/material/tabs';
import { NgxSpinnerModule } from "ngx-spinner";
import { CreateUserComponent } from './components/create-user/create-user.component';
import {MatPaginatorModule} from '@angular/material/paginator';
import {MatSortModule} from '@angular/material/sort';
import {MatExpansionModule} from '@angular/material/expansion';
import {MatDialogModule } from '@angular/material/dialog';
import {MessageComponent} from './components/message/message.component';
import {MatInputModule} from '@angular/material/input';
import {MatSelectModule} from '@angular/material/select';
import {MatRadioModule} from '@angular/material/radio'; 
import { RolesComponent } from './components/roles/roles.component';
import {AuthService } from './service/rest-services/authentication.service';
import { HomeComponent } from './components/home/home.component';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatStepperModule } from '@angular/material/stepper';
import { StepperComponent } from './components/stepper/stepper.component';
@NgModule({
  declarations: [
    AppComponent,
    DatepickerApiComponent,
    StepperComponent,
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    LayoutModule,
    MatToolbarModule,
    MatButtonModule,
    MatSidenavModule,
    MatIconModule,
    MatListModule,
    MatCardModule,
    MatTableModule,
    HttpClientModule,
    NgbModule,
    MatFormFieldModule,
    MatDatepickerModule,
    MatNativeDateModule,
    FormsModule,
    ReactiveFormsModule,
    MatTabsModule,
    MatPaginatorModule,
    NgxSpinnerModule,
    MatSortModule,
    MatStepperModule,
    MatExpansionModule,
    MatDialogModule,
    MatInputModule,
    MatSelectModule,
    MatRadioModule,
    MatCheckboxModule,
    FlexLayoutModule,
  ],
  entryComponents: [MessageComponent],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  providers: [RestService,AppConstants,AuthService,AlmInterfaceService,
    {provide:DateAdapter,useClass:AppDateFormatAdapter},
    {provide:MAT_DATE_FORMATS,useValue:APP_DATE_FORMATS}
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Package.json

  "name": "ca-application",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~9.1.9",
    "@angular/cdk": "^9.2.4",
    "@angular/common": "~9.1.9",
    "@angular/compiler": "~9.1.9",
    "@angular/core": "~9.1.9",
    "@angular/flex-layout": "^9.0.0-beta.31",
    "@angular/forms": "~9.1.9",
    "@angular/localize": "^9.1.11",
    "@angular/material": "^9.2.4",
    "@angular/platform-browser": "~9.1.9",
    "@angular/platform-browser-dynamic": "~9.1.9",
    "@angular/router": "~9.1.9",
    "@ng-bootstrap/ng-bootstrap": "^6.1.0",
    "bootstrap": "^4.5.0",
    "file-saver": "^2.0.5",
    "ngx-spinner": "^9.0.2",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.901.12",
    "@angular/cli": "~9.1.7",
    "@angular/compiler-cli": "~9.1.9",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~3.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~3.8.3"
  }
}

Could you please let me know what I'm doing wrong?

Paul-E
  • 91
  • 12
  • check in chrome, what style are applied, and if border-bottom is overridden, check also in styles.scss – JiBi Mar 10 '21 at 10:23
  • Sorry, I dont have chrome installed in my machine. is it okay to check in 'Edge'? – Paul-E Mar 10 '21 at 12:00
  • yes, if you click the element "mat-form-field-ripple" you should see you primary color set as background-color; – JiBi Mar 10 '21 at 13:21
  • @JiBi : I have uploaded how the div looks like in edge in below link, please have a look: https://i.stack.imgur.com/DJBbJ.png . It seems like the div is enabled in edge, but, the underline is not visible – Paul-E Mar 10 '21 at 13:37

1 Answers1

0

look here, you might have to set mat-focused manually to have a better view enter image description here

JiBi
  • 378
  • 1
  • 6