I'm facing an issue with my Users.class where I need it to automatically map or bind after fetching data from Firebase. I've been trying to search for the right term but haven't found any information yet.
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute} from '@angular/router';
import { Users } from '../Users';
import { UserService } from '../service/user.service';
@Component({
selector: 'app-edituser',
templateUrl: './edituser.component.html',
styleUrls: ['./edituser.component.scss']
})
export class EdituserComponent implements OnInit {
constructor(private route : ActivatedRoute, private userService : UserService) { }
user : Users;
key : string;
ngOnInit() {
this.route.paramMap.subscribe(params =>{
params.get('userKey');
});
this.userService.getUser(this.key).valueChanges().subscribe(data =>{
user = data;
})
}
}
This specific section is where I'm encountering difficulties:
user : Users;
key : string;
ngOnInit() {
this.route.paramMap.subscribe(params =>{
params.get('userKey');
});
I have a Users Service to retrieve the data, but I'm unsure how to pass it into my Users Custom Class. Or in other words, bind it properly.