log from web do not know why line 41 is undefined. just want to assign the value to the local variable "users". able to assign the value to a variable or log inside the subscribe function.
This is angular code:
export class UserProfileComponent implements OnInit {
id = '';
users;
constructor(private route: ActivatedRoute,
private afs: AngularFirestore,
private afsauth: AngularFireAuth,
public Auth: AuthService) { }
ngOnInit() {
const collection: AngularFirestoreCollection<any> = this.afs.collection('users');
// Notice how the observable is separated from write options
const collection$: Observable<any> = collection.valueChanges();
collection$.subscribe(data => console.log(data));
this.getuid();
}
//this.user = this.afsauth.auth.currentUser
getuid(){
this.Auth.user.subscribe((data:any) => {
this.users = data.uid;
console.log(data);
console.log(this.users);
});
console.log(this.users);
}
}