0
Ich möchte die Schriftart dieses Eingabetextes ändern, indem ich die Schriftfamilie auswähle, aber so wie es ist, funktioniert es nicht ... Ich habe mehrere Auslöser ausprobiert, aber keiner von ihnen hat funktioniert. Was ich habe, so weit:Ändern der Schriftfamilie (einer Eingabe) mit Auswahl in Angular 4?
HTML
<mat-form-field id="input-font" (click)="changeFont (this);">
<mat-select placeholder="Font">
<mat-option value="Times New Roman" selected ="selected">Times
</mat-option>
<mat-option value="Arial">Arial
</mat-option>
<mat-option value="Roboto">Roboto
</mat-option>
</mat-select>
</mat-form-field>
<form novalidate #f="ngForm" (submit)="onSubmit(f);">
<mat-form-field>
<input matInput placeholder="Name"
id="output-text"
name="name"
[ngStyle]="{'color':'red', 'font-size':'17px'}"
[(ngModel)]="user.name"
#userName="ngModel"
placeholder="Name"
minlength="2"
required>
</mat-form-field>
Typoskript
changeFont(font){
document.getElementById("output-text").style.fontFamily = font.value;
}
großartig, es funktioniert! Danke @Gergo Kajtar – Mellville