From 5222961c6853739c3443f13adfff67b9b48d3e97 Mon Sep 17 00:00:00 2001 From: Art Date: Tue, 21 Sep 2021 10:52:53 +0300 Subject: [PATCH] 165. Getting profile image and click save button (#22) --- .../src/app/component/user/user.component.html | 6 +++--- .../src/app/component/user/user.component.ts | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/support-portal-frontend/src/app/component/user/user.component.html b/support-portal-frontend/src/app/component/user/user.component.html index 42919c2..4758083 100644 --- a/support-portal-frontend/src/app/component/user/user.component.html +++ b/support-portal-frontend/src/app/component/user/user.component.html @@ -219,8 +219,8 @@
+ (change)="onProfileImageChange($any($event).target.files)" + class="custom-file-input">
diff --git a/support-portal-frontend/src/app/component/user/user.component.ts b/support-portal-frontend/src/app/component/user/user.component.ts index e7050c8..050265c 100644 --- a/support-portal-frontend/src/app/component/user/user.component.ts +++ b/support-portal-frontend/src/app/component/user/user.component.ts @@ -20,6 +20,8 @@ export class UserComponent implements OnInit, OnDestroy { public refreshing: boolean; private subscriptions: Subscription[] = []; public selectedUser: User; + public profileImageFileName: string; + public profileImage: File; constructor(private userService: UserService, private notificationService: NotificationService) { @@ -64,11 +66,16 @@ export class UserComponent implements OnInit, OnDestroy { document.getElementById('openUserInfo')?.click(); } - public onProfileImageChange(event: any): void { - console.log(event); + public onProfileImageChange(fileList: FileList): void { + this.profileImageFileName = fileList[0].name; + this.profileImage = fileList[0]; } private sendErrorNotification(message: string) { this.notificationService.notify(NotificationType.ERROR, message ? message : 'An error occurred. Please try again') } + + public saveNewUser(): void { + document.getElementById('new-user-save')?.click(); + } }