Angular / Angularfire2 How to get result as typed object ?

6 views
Skip to first unread message

Fairydhwen

unread,
Apr 26, 2017, 2:35:58 AM4/26/17
to Angular and AngularJS discussion

Hey guys,

i'm using Angularfire2 to get data from firebase.but i cant find a way to map results directly to an array of <T> on my subscribe =>.

Do you have any exemple using class object to map the result ?

At the moment i can recreate new Message() that i push on my Message[] with a data.ForEach... but it looks like to be an old school way :/

Regards,

Fairy

Sander Elias

unread,
Apr 26, 2017, 2:46:09 AM4/26/17
to Angular and AngularJS discussion
Hi Fairydwen,

I believe AF2 hands you an observable, so you can use the map operator to do the mapping, before you subscribe to it.

Regards
Sander
Reply all
Reply to author
Forward
0 new messages