125 questions
0
votes
0
answers
47
views
Angular Material mat-form-field label misaligned with prefix icon on initial render
I'm using Angular Material's mat-form-field with appearance="outline" and a prefix icon (matPrefix). On initial render, when the input is empty, the label appears too close to the prefix ...
1
vote
1
answer
100
views
mat-form-field validation messages dispalying before any user interaction
Here is the code for reference,
<div>
<mat-form-field class="w-100 mt-2" appearance="outline">
<mat-label>Enter a name for your quote</mat-...
1
vote
1
answer
62
views
Mat form field value alignment issue when density is -3
I'm having trouble centering the value of the input vertically.
When the density is -3 and the font size is 1em the value of the input is not centered correctly.
Also the label alignment when there's ...
2
votes
1
answer
89
views
<mat-form-field> component doesn't work properly with FormArray and formGroupName
The input field is not displayed with the appearance of <mat-form-field> before clicking inside when formGroupName is used with FormArray.
See the example:
TS:
formMain = this.fb.group({
...
0
votes
1
answer
215
views
Angular mat-form-field appearance='fill' or 'outline'
Is there a way to use CSS to set appearance='fill' or 'outline' on a mat-form-field without having to use {provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: {appearance: 'outline'}}?
I'm asking ...
0
votes
2
answers
850
views
Modifying Angular 16 mat-form-field styles
I am looking to change the default styling of Angular Material's MatFormField. I want to reduce the inner padding of the input field in a form field, and reduce the gap between each form field.
I am ...
1
vote
1
answer
94
views
Angular throws missing MatFormFieldControl error in mat-form-field when it's referenced by a template. Direct insert works fine
So this is the working code:
<mat-form-field *ngIf="asFormFieldWithLabel; else selector" style="width: 100%;">
<mat-label>{{asFormFieldWithLabel}}</mat-label>
...
1
vote
1
answer
166
views
Cannot find control with name for last form control
I have a small project to display images on our nas.
I'm using angular 17.
On the main page I have 3 mat-form-fields. For some reason when I add the last of the tree mat-form-fields I get the error - ...
0
votes
1
answer
711
views
Date input suffix not appearing inside a matFormField after Angular upgrade
I have an Input of type 'datetime-local' inside a matFormField, like this:
<mat-form-field>
<input
formControlName="dateTimeSelect"
matInput
...
0
votes
0
answers
447
views
input rendering problem using mat form field from Angular Material
I am creating a login form for my application, and using the mat-form-field component for my inputs, but when I open the login page I notice that the input does not appear in the correct way, it ...
0
votes
1
answer
821
views
Mat-form-field outline color and size change
I have a mat-form-field with a date range picker in Angular 16.I am try to change the color and size of the input but having a hard time.Can anyone assist please ?
Here is my code :
<div class=&...
8
votes
3
answers
5k
views
"Form-Field" with appearance="outline" is cut off from other labels [closed]
After updating to Angular Material v15 our form fields look like this (sometimes - depending on if there is a margin/padding from the element above):
This is how it looked like before:
From what I ...
0
votes
1
answer
95
views
How can I make an enum appear in my Angular Mat-Form-Field?
This is my app - My app
How can I write in Java/Visual Studio that in my app when I click on "Upgrade" for the id 1, the "Account" row, to appear CASH - the default value? For now ...
0
votes
2
answers
826
views
How to enable input fields if a certain mat-option is selected or not?
Based on this topic's accepted answer, I managed to get the selected state of the clicked option. I want to disable an input based on a selection of a certain option. With the below example, I am able ...
1
vote
1
answer
944
views
Form validation in Angular mat form
I am building login form using angular mat form.
Login form is following.
login-form.component.html
<form [formGroup]="registerForm" (ngSubmit)="onSubmit()">
<div ...
1
vote
1
answer
1k
views
Can't use ng-content with mat-form-field
I’m trying to do a dynamic form with Angular Material. ng-content doesn’t seems to work with mat-form-field.
I’m getting this error message:
ERROR TypeError: Cannot read properties of undefined (...
1
vote
1
answer
119
views
Angular datepicker downside of input field
When i tried to open angular material datepicker it was opening upside of an input field.
How to make it to open downside of an input field.
<mat-form-field appearance="outline" class=&...
0
votes
1
answer
412
views
Error NG8001: 'mat-label' is not a known element
As a title, I'm encountering this error with the mat-label and input. After a day of troubleshooting, I couldn't resolve it. I've read a lot of similar question that has been resolved by importing the ...
1
vote
0
answers
582
views
how to make two mat-form-field inputs stay inside the parent div without extrapolating?
I'm trying to make two "mat-form-field" side by side and not break the parent div.
And, here is the code:
<div class="flex gap">
<mat-form-field appearance="...
0
votes
0
answers
796
views
Angular Material: ERROR Error: mat-form-field must contain a MatFormFieldControl
Good afternoon!
These days i've been working on to a pokemon-based project which consists in getting a random attack (1 of 4 strings) just by choosing in two selects (the trainer and the pokemon one).
...
0
votes
1
answer
2k
views
Toggle show/hide password angular
I have an angular application that has a login screen. I want to allow the user to toggle the password from being concealed to seeing the text by clicking on an eye in the input box. I am trying to ...
1
vote
0
answers
264
views
Right aligned italic letter get cut off partially in mat-form-filed angular
I have some mat-form-field, the data of that field is right aligned and it's font style will set dynamically. if we set the font-style italic the last letter get cut off partially.
<mat-form-...
0
votes
1
answer
854
views
Angular drop down giving same value for other two options in mat form
I am trying to get selected option in angular through below code. But when I select 1 drop down option then other two gets same as shown in pic. How can I fix this.
<div *ngFor="let candidate ...
0
votes
1
answer
1k
views
Highlight mat-form-field on invalid value without [(ngModel)]
I have a mat-form-field with the following input inside of a form :
<input matInput name="input" type="number" step="any" (input)="doSomething()" required /&...
0
votes
2
answers
1k
views
Change color of mat-select based on mat-option
So I have a dropdown:
<div class="drop-down" >
<mat-select>
<mat-option *ngFor="let role of roles | keyvalue" [value]="role">
...