typescript - Angular 4 Firebase Observable with .map() apears two times on refresh and not reversed -
i using angular 4 firebase , angularfire. want display on html code first top 10 users, code is
export class homefillercomponent implements oninit { topusers: observable<any>; constructor(db: angularfiredatabase,public authservice: authservice) { this.topusers = db.list('users', { query: { orderbychild: "totalscore", limittolast: 10, } }).map((topusers) => {console.log(topusers); return topusers.reverse();}) }
my firebase database is:
"users" : { "test1" : { "totalscore" : 50, "username" : "test1" }, "test2" : { "totalscore" : 30, "username" : "test2" }, "test3" : { "totalscore" : 20, "username" : "test1" }, "test4" : { "totalscore" : 10, "username" : "test1" }, "zekes" : { "totalscore" : 14, "username" : "zekes" } }
when navigate in angular 4 app works fine.however when refrest page 2 console.log(a)
1 reversed object , second 1 not reversed object.so html displays not reversed object. have idea of wrong?? happens when refresh page. console.log(a)
when refresh page.
Comments
Post a Comment