From the course: Angular: Cloud-Powered Apps with Firebase

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Image uploads

Image uploads

From the course: Angular: Cloud-Powered Apps with Firebase

Start my 1-month free trial

Image uploads

- [Instructor] Let's write the code now to upload the user photo to Firebase. Heading to the application module, we'll first import the AngularFireStorageModule. Now it will be from angular/Fire/storage. And make sure to add this module to the imports here. Heading now to the profile component we will declare two additional variables. First one will be a download URL which will be an observable of type string. This will be used to get the source of the user's profile image. We will also declare a second variable and call it uploadProgress. And this will be an observable of type number. This will be used to display a progress bar. In the constructor we will inject the angular fire storage service. We can call this afStorage, and that will be of the type AngularFireStorage. In the constructor we can then get the download URL. We will do so by grabbing a reference to the path the user will be uploading their photo to.…

Contents