Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Material matInput content aligned to the right

How do we align the input of matInput in Angular Material to the right?

My current code:

<mat-form-field>
  <input matInput type="number" id="amount" placeholder="Amount"
    [ngModel]="entry.amount | number :'1.2-2'"
    (ngModelChange)='entry.amount=$event' />
</mat-form-field>

Desired output :

enter image description here

like image 759
trashvin Avatar asked Dec 15 '17 06:12

trashvin


1 Answers

Using the standard text-align CSS property should just work.

<input matInput class="right">

.right { text-align: right }
like image 135
Lazar Ljubenović Avatar answered Sep 22 '22 14:09

Lazar Ljubenović