ngx-storage-firebaseui - Open Source Library for Angular Web Apps to integrate a material user interface for firebase storage.
Angular UI component for firebase authentication. This library is an angular module (including angular components and services) that allows to upload/download or event delete files from firebase storage within a firebase project.
Built by and for developers ❤️
Do you have any
question or suggestion ? Please do not hesitate to contact us!
Alternatively, provide a PR | open an appropriate issue here
If you like this project, support ngx-storage-firebaseui by starring ⭐️ and sharing it 📢
Table of Contents
- Why to use ngx-storage-firebaseui ?
- Library's components
- Requirements
- Demo
- Screenshots
- Peer Dependencies
- Dependencies
- Firebase Cloud Functions and Firebase extensions
- Installation
- Usage
- API
- Run Demo App Locally
- Other Angular Libraries
- Support
- License
Why to use ngx-storage-firebaseui ?
- 💝 it uses a responsive and accessible web design UX/UI from google material concepts and components (supporting desktop, tablet and mobile view) incl. smooth animations for a better UX.
- 💄 pick up your own theme! change the primary, accent and warn colors whenever you need (e.g to support light and dark themes)
- 🚢 super easy to use with an angular based project (project that is created with the angular-cli)
- 🔜 optional configuration
- ♻️ configure your components in runtime
- ♻️ reusable components for every project that needs some uploads workflows with a firebase project/app.
- 🛃 built in feedback mechanism in form of a snackbar when an error or
any
important event occurred. - 🆘 ability to delete files
- 👻 compatible with
ngx-auth-firebaseui
learn more - 🔥 Sync user's uploads with FIRESTORE AUTOMATICALLY
- 🎉 Supports SSR - Server Side Rendering
- 🔜 support of i18n
Library's components
<ngx-storage-firebaseui-images>
used to upload imaged to firebase storage and sync them with firestore
Supported Processes/Workflows and Actions:
- upload images
- image grid
- delete image (soon)
- pre-built firebase functions to auto-rotate images (soon)
- angular material theme
- angular material icons
- angular cdk - v9.x
- angular material - v9.x
- angular animations - v9.x
- angular router - v9.x
- angular flex-layout v9.0.0-beta.29
- @angular/fire - v5.4.x
- firebase - v7.13.x
the full tutorial guide can be found here
Demo | Features | Examples
Peer Dependencies - please make sure that peerDependencies are installed if you are not using the schematics
"peerDependencies":
Dependencies
- Angular (requires Angular 2 or higher, developed with 9.x) - obviously
In the following section, I will show you how to improve the user's experience regarding images
Install firebase extension - Resize Images
- install the storage resize images extension in your firebase project
- set your firebase cloud function's location
- pick either the default bucket or choose another one
- set size images:
50x50,100x100,200x200,500x500,1000x1000,2000x2000
- choose whether to delete the original image (tip: don't do that so that you can regenerate the thumbnails)
- choose the cloud storage path for resized images
thumbs
(see below an example of an image directory in firebase storage)
after installation
required
)
Upload firebase cloud functions to sync the uploaded images to firebase storage with firestore (firebase init
- init firebase cloud function in your firebase project (
typescript
) - copy and paste the below functions
- upload
firbease deploy --only functions
;;;// tslint:disable-next-line:no-implicit-dependencies;// @ts-ignore// tslint:disable-next-line:no-implicit-dependencies; ;;;// tslint:disable-next-line:no-implicit-dependencies;// tslint:disable-next-line:no-implicit-dependencies;; ;;// const defaultBucket = defaultStorage.bucket(); /** * Firebase cloud function to sync uploaded images to firebase storage bucket with firestore * * @author Anthony Nahas * @since 03.2020 * @version 1.0 */; .storage .object .onFinalize;
(1) Installation
1. Install via ng add. (Recommended)
If Angular Material Design is not setup, just run ng add @angular/material
learn more
Now add the library via the angular schematics
ng add ngx-storage-firebaseui
- ✔️ peer dependencies will be automatically added the package.json and installed
- ✔️
ngx-storage-firebaseui
's module will be automatically imported to the root module (just replacePUT_YOUR_FIREBASE_API_KEY_HERE
with your firebase api key) - ✔️
ngx-storage-firebaseui
's assets will be automatically added theangular.json
file
2. Install via npm. (Alternative)
Install above dependencies via npm.
Now install ngx-storage-firebaseui
via:
npm install --save ngx-storage-firebaseui
npm i -s @angular/material @angular/cdk @angular/flex-layout @angular/forms @angular/animations @angular/router
Firebase deps
npm i -s firebase @angular/fire
-> continue by following the instructions
here
Once installed you need to import the main module:
;
The only remaining part is to list the imported module in your application module. The exact method will be slightly
different for the root (top-level) module for which you should end up with the code similar to (notice NgxStorageFirebaseuiModule .forRoot()
):
and then from your Angular AppModule
:
;; ; // Import your library;;
Other modules in your application can simply import NgxStorageFirebaseuiModule
:
; @
SystemJS
Note:If you are using
SystemJS
, you should adjust your configuration to point to the UMD bundle. In your systemjs config file,map
needs to tell the System loader where to look forngx-storage-firebaseui
:
'ngx-storage-firebaseui';: 'node_modules/ngx-storage-firebaseui/bundles/ngx-storage-firebaseui.umd.js'
Usage
(3)Once the library is imported, you can use its components, directives and pipes in your Angular application:
<ngx-storage-firebaseui-images></ngx-storage-firebaseui-images>
see the usage
API
<ngx-storage-firebaseui-images></ngx-storage-firebaseui-images>
see the api
option | bind | type | default | description |
---|---|---|---|---|
path | Input() |
string |
- | path to store the image into firebase storage as well as in the firestore |
load | Input() |
boolean |
true |
whether to load the uploaded images from firebase |
addButtonTooltipText | Input() |
string |
add picture |
text of the add button tooltip |
onLoad | Output() |
number |
- | called when the images are loaded from firestore |
onImageUploaded | Output() |
number |
- | called when an image is uploaded to firebase storage |
onImageSelectedAtIndex | Output() |
number |
- | called when an image is selected / clicked |
Other Angular Libraries
- ngx-auth-firebaseui
- ngx-linkifyjs
- @angular-material-extensions/password-strength
- @angular-material-extensions/google-maps-autocomplete
- @angular-material-extensions/fab-menu
- @angular-material-extensions/select-country
- @angular-material-extensions/pages
- @angular-material-extensions/link-preview
- @angular-material-extensions/contacts
- @angular-material-extensions/faq
- angular-material-extensions/freelancer-theme
- @firebaseui/ng-bootstrap
Support
- Drop an email to: Anthony Nahas
- or open an appropriate issue
- let us chat on Gitter
Built by and for developers ❤️ we will help you 👊
This project is supported by jetbrains with 1 ALL PRODUCTS PACK OS LICENSE incl. webstorm
License
Copyright (c) 2020 Anthony Nahas. Licensed under the MIT License (MIT)