Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular2 ngFor content not rendered on Safari

I have a list of elements in an ngFor loop. When I refresh the page, only the first elements data is loaded. When I click an empty element the data suddenly pops up. This happens only when viewed in Safari. How can I get Safari to load all content?

enter image description here

<article *ngFor="let item of list; let i = index">
    <section class="item__content">
      <h3 class="item__name">
        <a href="#">{{item.name}}</a>
      </h3>
      <p>
        {{item.description}}
      </p>
    </section>
</article>

Data comes from an API which's serves JSON.

like image 715
Ferdi Emmen Avatar asked Apr 29 '16 14:04

Ferdi Emmen


1 Answers

After a lot of trial and error my problem was a |date pipe that was missing a specific format.

<time>{{topic.lastPostAt|date}}</time>

Changing it to this solved it for me:

<time>{{topic.lastPostAt|date:"MM/dd/yy"}}</time>

My example code on StackOverflow was missing this though. For some reason Safari was only able to render the content when a user event was triggered.

like image 165
Ferdi Emmen Avatar answered Sep 21 '22 09:09

Ferdi Emmen