2

I have a component for a textbox that I use for all login fields. Inside it I have a switch through I give particular features; example:

case 'password':
    this.textField.nativeElement.secure = true;

I created another field inside the switch and I want to assign it a class in the global css because I need to change the color and the text-size only for this case. How can I do it?

1 Answer 1

3

You can dynamically apply a class to an element using this

[class.className]="booleanCondition"

You can define a global css file and then reference it in multiple components

styleUrls: ['./text-box.component.css', '../../../shared/shared-styles.css']
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.