Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.82 KB

File metadata and controls

53 lines (37 loc) · 1.82 KB

AngularFire ❱ Developer Guide ❱ Remote Config

Remote Config

Firebase Remote Config is a cloud service that lets you change the behavior and appearance of your app without requiring users to download an app update.

Learn More

Dependency Injection

As a prerequisite, ensure that AngularFire has been added to your project as described in the Quickstart.

Provide a Remote Config instance in the application's app.config.ts:

import { ApplicationConfig } from '@angular/core';
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
import { provideRemoteConfig, getRemoteConfig } from '@angular/fire/remote-config';

export const appConfig: ApplicationConfig = {
  providers: [
    provideFirebaseApp(() => initializeApp({ ... })),
    provideRemoteConfig(() => getRemoteConfig()),
    ...
  ],
  ...
}

Next inject RemoteConfig into your component:

import { Component, inject} from '@angular/core';
import { RemoteConfig } from '@angular/fire/remote-config';

@Component({ ... })
export class RemoteConfigComponent {
  private remoteConfig = inject(RemoteConfig);
  ...
}

Firebase API

AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.

Update the imports from import { ... } from 'firebase/remote-config' to import { ... } from '@angular/fire/remote-config' and follow the official documentation.

Getting Started | API Reference