61 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
2
answers
88
views
Angular: Numbers only directive
I have this piece of code
<input matInput type="number" [(ngModel)]="value"
(ngModelChange)="onChange(true)" />
But I want to be able to enter only numbers, ...
1
vote
1
answer
94
views
How to reduce matInput height to certain value?
I have simple matInput element from angular-material library:
<mat-form-field class="example-form-field">
<mat-label>Clearable input</mat-label>
<input matInput type=...
2
votes
1
answer
121
views
How to press enter in matinputharness unit tests?
I want to submit my input when pressing enter.
I tried to do it like that:
input.setvalue('test');
const result = await input.host();
await result.sendsKey('enter');
expect(input.getValue()).toBe('');
...
1
vote
1
answer
73
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 ...
0
votes
1
answer
382
views
Angular Mat Input text is not working. It Displays, but cannot edit
I ́ve encountered this problem where I use the mat Input
<mat-form-field>
<input matInput placeholder="Ex. Pizza" value="Sushi">
</mat-form-field>`
The thing is, ...
0
votes
0
answers
180
views
During updating from Angular 11 to 12 I get Parser Error: Conditional expression min ?? null requires all 3 expressions at the end of the expression
I have a problem after updating to angular 12 from angular 11 the whole project is red with errors in VS Code wherever I'm using input type="number" with min = "1" and [(ngModel)].
...
0
votes
0
answers
1k
views
How to add custom mask in Angular using ngx-mask?
I am trying to add a custom mask in angular using regular expression.
Here is the mask I want:
Characters allowed: Capital Letters, Small Letters, and Numbers
Length of the field: 20
Can start the ...
0
votes
1
answer
1k
views
Style mat input on error (adding a mat icon to input field on error)
I'm trying to style my mat input field on an error by adding an error icon next to the clear field icon like this:
I can't find any way to add the icon. Thank you for your help in advance.
My HTML:
&...
3
votes
2
answers
781
views
Angular Material custom input validation message not showing with mat-stepper
I implemented custom control based on official guides using ControlValueAccessor:
https://material.angular.io/guide/creating-a-custom-form-field-control
https://blog.angular-university.io/angular-...
0
votes
1
answer
1k
views
Set color of matInput outline dynamically
I've got a basic Angular Material input field like this:
<mat-form-field appearance="outline">
<input matInput type="text">
<button ...
user avatar
user17087006
0
votes
1
answer
1k
views
Angular - why key.enter is not working inside mat-menu
I have the following input and I want to fire the event after pressing enter:
<input
matInput
type="number"
min="0"
placeholder="0"
(keyup.enter)=...
1
vote
2
answers
3k
views
How to mask all characters except last 3 characters on a string display only
Hi I am working in Angular and in one of the field which is phone number ,I want to mask the string on HTML view only except the last 3 characters. How can I do that ?
Example: - 1212121212 as ...
0
votes
1
answer
1k
views
How to use HTML input "time" with Angular FormGroup?
I want to allow user edit only time in my datetime form-field, but when user submits form the value is null
<form [formGroup]="activityForm" (ngSubmit)="onSubmit()">
<...
1
vote
0
answers
360
views
Angular Material input reusable - Type number
I'm trying to create a reusable matInput with controlValueAccessor. When I pass the type with @Input(), I got the good behavior but my data number is convert in string. I create a stackblitz
https://...
1
vote
1
answer
2k
views
How to prevent matInput from focusing when clicking on matPrefix/matSuffix?
I'm trying to implement a counter form field. It has two buttons; one for incrementing the count value and one for decrementing it. Implementation has been pretty straightforward so far.
<mat-form-...