I created a user photo component that takes the value @Input() , this is the value of userId. If the value is passed, I retrieve the information from Firebase , referring to this userId, if it is not, I am doing something else.
My custom component photo
import { Component, OnInit, OnDestroy, Input } from '@angular/core'; @Component({ selector: 'user-photos', templateUrl: './user-photos.component.html', styleUrls: ['./user-photos.component.css'] }) export class UserPhotoComponent implements OnInit { @Input() userId: string; constructor() { console.log('userId is:',this.userId); } ngOnInit() { } ngOnDestroy() { } }
As you can see, I declared userId as @Input() , now on my edit-profile component I have the following:
<user-photos [userId]="TestingInput"></user-photos>
Now the User Photo component gets rendered as I see the h1 tag, but is userId always undefined?
Errors do not appear in the developer console, so I'm not quite sure what I did wrong.
source share