Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Ngfor not working

$
0
0

@polska03 wrote:

My page looks like this:

<ion-item *ngFor="#item of items; #i=index" >
 <h2>{{ item }}</h2>
</ion-item>

My ts page looks like this:

let t=setInterval(function() {
           console.log('looping...');
            this.items  = ["a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"];
        },1000);

The javascript is looping as it is printing in the console, but my list is not being populated. If I take out the interval and just have:

this.items  = ["a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"];

it displays properly then. So it is a problem with the interval it looks like. I am not sure what the problem is?

PS. I know my code looks like it is not doing anything as the same items are being set, but my code is actually longer and has much more business logic, but this interval concept is not working for me and I am trying to find out why.

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>