Solution 1 :

Import the styles not in the template but in the component itself.

Look in Angular docs

Problem :

I want to inject style to div in component. My issue is it’s scss and in application we use scss but style does not want to work. When inject the same style as css one. Everything works fine. The question is how can I force my component to execute style like this? Is it even possible or should I convert scss style to css one?


  <div id="myExampleId">
    <div #htmlContainer [innerHtml]="htmlToDisplay | safehtml"></div>

Style to display in component:

#myExampleId {
table {
  border-collapse: collapse;
  width: 100%;


td, th {
  border: 1px solid #999;
  padding: 0.5rem;
  text-align: left;

body {
  background-color: #fe996b;