Is it possible to retrieve the value of item.profile image and utilize it in the update function shown in the code below?
<ion-content>
<ion-grid style ="text-align: center">
<ion-row class="ion-align-items-center" >
<ion-col class="ion-align-items-center" *ngFor="let item of students" >
<ion-avatar class="ion-align-items-center">
<ion-img [src] = "item.profileImage"></ion-img>
</ion-avatar>
</ion-col>
</ion-row>
<ion-row style ="text-align: center">
<ion-col>
<ion-button size="small" fill="outline" (click)="chooseProfilePic()" >Choose Profile Photo</ion-button>
</ion-col>
</ion-row>
</ion-grid>
Why does using this.item.profileImage as a value result in an undefined error in the console?
export class EditProfilePage implements OnInit {
item: any
this.profileImage = "./assets/imgs/user.png" || this.item.profileImage;
this.profileService.read_Students().subscribe(data => {
this.students = data.map(e => {
return {
id: e.payload.doc.id,
isEdit: false,
userName: e.payload.doc.data()['userName'],
userBio: e.payload.doc.data()['userBio'],
profileImage: e.payload.doc.data()['profileImage'],
};
})
console.log(this.students);
UpdateRecord(recordRow) {
let record = {};
record['userName'] = recordRow.userName || "" ;
record['profileImage'] = this.item.profileImage;
record['userBio'] = recordRow.userBio || "" ;
this.profileService.update_Student(recordRow.id, record);
recordRow.isEdit = false;
}