How to change text font and text color

Hi all,

I have a text in app and i want to change this text font and color when i click the button.
I did change background image “buttonclick” and .ts but this way doesnt allow change text color or font so any solution ?

1 Like

Okey its sounds good but dont miss me i think its not be dynamic.I search the forum and i found [NgClass].Whats your opinion for this ? Like this :> Adjust font sizes with a range component

1 Like

i would solve it trough .scss with adding main class for fonts and colors in the variables.scss also for the buttons it is the simplest way.

the are already inside … for example

$colors: (
bgContent: #f1f1f1,
primary: #009900,
secondary: #32db64,
danger: #f53d3d,
light: #f4f4f4,
dark: #222
);

of course u can do it with ng class but in my opinion its not necessary.

Okey thanks a lot.I wrote your code but i dont understand in your code sorry, its for button but i dont use button i use ioncard title in “p” tag and i cant change “p” style i try the click but i cant put src in “p” Maybe you can help me
.Html code

<div class="card-title">
<p style="font-weight: bold; font-size: 50px; color: white;" absolute-drag>example123</p>
</div>

.sccs

.example {color: red;}

and i have just a button you know.
I cant figure out because nothing is worked :frowning:

sorry i misunderstood ur question ^^

u can add an additional class to your html tag which contains the style and if u click on ur button u can add or remove the additional styles.

Okey its good but how access style code when i click the button.Its okey for img or anything but its style so how can i to intervene ? Thanks

here little example for u :slight_smile:
https://plnkr.co/edit/fNoXWhUhMaUoeMihbGYd?p=preview

Hi sorry for late answer and thanks for help :slight_smile: ı did like this maybe this link helpful
: https://scotch.io/tutorials/angular-2-classes-with-ngclass-and-ngstyle

1 Like