Wednesday, April 11, 2018

how to hand a style into ng-content injections

<div>
   Look at this graph:
   <nickelback [details]="'data'" [width]='3'>
      <h1>Whatever</h1>
      <span class="date-italic">since 1995</span>
   </nickelback>
</div>

 
 

Where will we define date-italic? In the nickelback component itself? That would defeat a lot of the point of injection, huh? No, you don't have to do it there. The same component that has the markup seen above, the one that has the nickleback selector tag inside of its template, should also define date-italic at it's CSS file! Part of the magic of ng-content is that this will work without the ::ng-deep hack!

No comments:

Post a Comment