Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@angular/fire

Package Overview
Dependencies
Maintainers
2
Versions
331
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular/fire

Angular + Firebase = ❤️

  • 18.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @angular/fire?

@angular/fire is the official Angular library for Firebase. It provides a set of AngularFire modules that enable Angular applications to interact with Firebase services such as Firestore, Authentication, Storage, and more. This library simplifies the integration of Firebase with Angular applications, offering reactive and declarative APIs.

What are @angular/fire's main functionalities?

Firestore

This feature allows you to interact with Firestore, a NoSQL database provided by Firebase. The code sample demonstrates how to retrieve a collection of items from Firestore and subscribe to changes in real-time.

import { AngularFirestore } from '@angular/fire/compat/firestore';

constructor(private firestore: AngularFirestore) {}

getItems() {
  return this.firestore.collection('items').valueChanges();
}

Authentication

This feature enables authentication functionalities such as signing in, signing out, and managing user sessions. The code sample shows how to sign in a user using email and password.

import { AngularFireAuth } from '@angular/fire/compat/auth';

constructor(private afAuth: AngularFireAuth) {}

login(email: string, password: string) {
  return this.afAuth.signInWithEmailAndPassword(email, password);
}

Storage

This feature allows you to interact with Firebase Storage, which is used for storing and serving user-generated content such as images and videos. The code sample demonstrates how to upload a file to Firebase Storage.

import { AngularFireStorage } from '@angular/fire/compat/storage';

constructor(private storage: AngularFireStorage) {}

uploadFile(filePath: string, file: File) {
  const fileRef = this.storage.ref(filePath);
  return fileRef.put(file);
}

Realtime Database

This feature provides access to Firebase Realtime Database, a cloud-hosted NoSQL database that allows data to be stored and synchronized in real-time. The code sample shows how to retrieve a list of items from the Realtime Database.

import { AngularFireDatabase } from '@angular/fire/compat/database';

constructor(private db: AngularFireDatabase) {}

getItems() {
  return this.db.list('items').valueChanges();
}

Analytics

This feature enables the use of Firebase Analytics to log events and track user interactions within your application. The code sample demonstrates how to log a custom event.

import { AngularFireAnalytics } from '@angular/fire/compat/analytics';

constructor(private analytics: AngularFireAnalytics) {}

logEvent(eventName: string, eventParams: any) {
  this.analytics.logEvent(eventName, eventParams);
}

Other packages similar to @angular/fire

Keywords

FAQs

Package last updated on 23 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc