glutengo / angular-mgl-timeline

Timeline component for Angular
MIT License
67 stars 33 forks source link

Expose side property #14

Closed raphaelman closed 6 years ago

raphaelman commented 6 years ago

In a design prospective, I think the side property would be helpful. I am trying to set style depending on the side where the box is.

glutengo commented 6 years ago

Hm I'm not sure if I understood you correctly. Do you want to style entries which are displayed on the right different to those which are displayed on the left?

If that's the case, this can easily be achieved by providing a class depending on the index, like this:

<mgl-timeline [toggle]="true">
   <mgl-timeline-entry 
      *ngFor="let entry of entries; let i = index" 
      [class.left]="i % 2 === 0" 
      [class.right]="i % 2 !== 0">...
   </mgl-timeline-entry>
</mgl-timeline>

If you want to achieve something else, please provide a more specific description of your issue.

raphaelman commented 6 years ago

You're right. I get what meant with that simple line: [ngClass]="i % 2 === 0 ? 'left' :'right'"