0

I am using Angular Material "MatSelectModule" for the select option when I call then in the controller the selection option is coming side by side like a text paragraph.

TypeScript File:

import { Component, OnInit, NgModule } from '@angular/core';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material';

@Component({
  selector: 'app-schedule-call',
  templateUrl: './schedule-call.component.html',
  styleUrls: ['./schedule-call.component.scss']
})


@NgModule({
  imports: [
    MatRadioModule,
    MatSelectModule
  ]
})


export class ScheduleCallComponent implements OnInit {
  foods = [
    {value: 'steak-0', viewValue: 'Steak'},
    {value: 'pizza-1', viewValue: 'Pizza'},
    {value: 'tacos-2', viewValue: 'Tacos'}
  ];
}

Component :

<div class="schedule-call-container">
    <mat-form-field>
        <mat-select placeholder="Favorite food">
          <mat-option *ngFor="let food of foods" [value]="food.value">
            {{ food.viewValue }}
          </mat-option>
        </mat-select>
      </mat-form-field>
</div>

1 Answer 1

1

Before you use any of the @angular/material components, import a theme like this:

@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';

More info about customizing themes here: https://material.angular.io/guide/theming

Sign up to request clarification or add additional context in comments.

2 Comments

Yes i have included this in style sass file still i don't see any change when i am inspected its coming but somewhere design are overriding
Is it in your Angular CLI configuration file? (aka .angular-cli.json)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.