Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onPhotoChange(event: any): void {
- const file = event.target.files[0];
- if (!file || !(/image\/(gif|jpg|jpeg|png)$/i).test(file.type)) {
- return;
- }
- this.photo = file;
- const reader = new FileReader();
- reader.readAsDataURL(file);
- reader.onload = () => {
- this.photoUrl = reader.result;
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement