P
P
Pavel Talaiko2019-07-22 18:13:49
Angular
Pavel Talaiko, 2019-07-22 18:13:49

What is the correct way to pass your styles to another Angular component?

Hello. The question is.
There is one component.

<div class="box">
  <div class="box__title">
    {{options?.title}}
  </div>
</div>

.box__title {
  box-sizing: border-box;
  flex-basis: 80%;
  margin-left: 25px;
  font-weight: 500;
  text-decoration: none;
}

I use this component in another component. And I want to transfer styles or classes to this component from the outside.
How to do it right?
<devpav-product-card (checked)="eventCheck($event)" [options]="options"></devpav-product-card>

Here you need to transfer a new style for the name
.box__title {
  text-decoration: none;
  color: white;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bugagashnik, 2019-07-23
@bugagashnik

I didn’t understand the essence a bit, but can I just pass the values ​​​​as props to the component, get them there via @Input () and use them as inline styles to the elements?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question