1.6 KiB
1.6 KiB
AngularFire ❱ Developer Guide ❱ Realtime Cloud Functions
Cloud Functions
The Cloud Functions for Firebase client SDKs let you call functions directly from a Firebase app. To call a function from your app in this way, write and deploy an HTTPS Callable function in Cloud Functions, and then add client logic to call the function from your app.
Dependency Injection
As a prerequisite, ensure that AngularFire
has been added to your project via
ng add @angular/fire
Provide a Cloud Functions instance in the application's NgModule
(app.module.ts
):
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
import { getFunctions, provideFunctions } from '@angular/fire/functions';
@NgModule({
imports: [
provideFirebaseApp(() => initializeApp(environment.firebase)),
provideFunctions(() => getFunctions()),
]
})
Next inject it into your component:
import { Component, inject} from '@angular/core';
import { Functions } from '@angular/fire/functions';
@Component({ ... })
export class AppComponent {
private functions: Functions = inject(Functions);
...
}
Firebase API
The Firebase API for Cloud Functions documentation is available on the Firebase website.
Convenience observables
More details coming soon.