1. 26
    Download Files from Firebase Cloud Storage in Angular
    1m 4s

Download Files from Firebase Cloud Storage in Angular

Jorge Vergara
InstructorJorge Vergara
Share this video with your friends

Social Share Links

Send Tweet

Users can now see that files are attached to tasks but they can't do much with that. We need to let users be able to download the files so we'll do that in this lesson.

We'll create a button for users to download the files they have in their tasks. We take a JavaScript first approach here by creating an anchor tag and adding all of the properties we need to allow for a download.

Instructor: [0:00] We also want to give the users the ability to download this file. For that, right after the label, we are going to add a right button that when the user clicks it, it's going to call the downloadAttachment function. Passing the attachment's name and the URL to that function.

[0:22] Now we can come here to create that function. There are multiple ways to downloading documents from the browser. I'm going to go with a pure JavaScript approach. I'm going to be creating an anchor tag. Then I'm going to add all of the properties that I need.

[0:47] After I add the properties, I'm going to append this link to the body. I'm going to click the link and I'm going to remove it. When I reload, I can see my download button. If I click the button, you see that we are downloading the new image.