I'm experiencing a very strange issue, I retrieve the users profile from Firebase inside this profile is an Photo Object basically an array of photos the user has uploaded.
My get Profile method:
getUserProfile(): Observable<User> {
    var userId = null;
    var auth = this.af.auth.subscribe(user => {
        userId = user.uid;
    });
    auth.unsubscribe();
    return this.af.database.object('/users/' + userId)
        .map(pro => new User(
            pro.$key,
            pro['email'],
            pro['gender'],
            pro['last_name'],
            pro['first_name'],
            pro['display_name'],
            pro['photos'],
            pro['hobbies']))
}
My user class is as follows:
export class User {
    public constructor(
        public userId: string,
        public email: string,
        public gender?: string,
        public last_name?: string,
        public first_name?: string,
        public display_name?: string,
        public photos: Photo[] = [],
        public hobbies: Hobbies[] = [],
    ) { }
}
Inside my component I call the getUserProfile as so:
this.userSubscription = this.profileService.getUserProfile().subscribe(profile => {
   console.log(profile.photo);
});
When I write console.log(profile.photos); I see the following:
Yet when I try to loop through this collection by doing the following:
for(var i = 0; i < profile.photos.length; i++){
   console.log('here');
}
Nothing is written to the console, even when I do the following:
console.log(profile.photos.length); it says undefined....
I'm not entirely sure what is going wrong, can anyone spot the reason into why I can't loop through the photo array and access the properties?

 
     
     
     
    