"AngularFireFunctions" documentation has two errors
The example code in the AngularFireFunctions documentation doesn't compile. Here's the provided code, with comments on the two lines that don't compile:
import { Component } from '@angular/core';
import { AngularFireFunctions } from '@angular/fire/compat/functions';
@Component({
selector: 'app-root',
template: `{ data$ | async }` // doesn't compile
})
export class AppComponent {
constructor(private fns: AngularFireFunctions) {
const callable = fns.httpsCallable('my-fn-name');
this.data$ = callable({ name: 'some-data' }); // doesn't compile
}
}
The template line needs double curly brackets:
template: `{{ data$ | async }}`
The next error is:
Property 'data$' does not exist on type 'AppComponent'.
6 template: `{{ data$ | async }}`,
I corrected this by making a variable data$: any.
This code now compiles:
import { Component } from '@angular/core';
import { AngularFireFunctions } from '@angular/fire/compat/functions';
@Component({
selector: 'app-component',
template: `{{ data$ | async }}`,
})
export class AppComponent {
data$: any;
constructor(private fns: AngularFireFunctions) {
const callable = fns.httpsCallable('my-fn-name');
this.data$ = callable({ name: 'some-data' });
}
}
This issue does not seem to follow the issue template. Make sure you provide all the required information.
Also, a sentence doesn't seem grammatical:
Notice that calling httpsCallable() does not initiate the request. It creates a function, which when called creates an Observable, subscribe or convert it to a Promise to initiate the request.
Maybe that should be:
Notice that calling httpsCallable() does not initiate the request. It creates a function, which when called creates an Observable. Subscribe to the Observable or convert it to a Promise to initiate the request.
Where is the latest documentation about AngularFire with Cloud Functions?
In Node.js functions.https.onCall and Angular httpsCallable