angular / angular/angularfire

"AngularFireFunctions" documentation has two errors

Open
#3,210 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.8k
Forks
2.2k
Avg merge
22h 28m
Merged PRs (30d)
6

Description

The example code in the [AngularFireFunctions](https://github.com/angular/angularfire/blob/master/docs/functions/functions.md) documentation doesn't compile. Here's the provided code, with comments on the two lines that don't compile:

```ts
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:

```ts
template: `{{ data$ | async }}`
```

The next error is:

```bash
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:

```ts
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' });
}
}
```

Contributor guide

Open the contributing guide

Research direction

Open docs/functions/functions.md and inspect the AngularFireFunctions example. Check the template interpolation and the AppComponent declaration against the reported TypeScript errors, then verify that the corrected example compiles and matches the documented callable-function usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.