angularfire
angularfire copied to clipboard
Firebase Function not working
Why my component dont render data from functions? but console.log() show returned value? async pipe dont render the value from functions,,,
import { BrowserModule } from "@angular/platform-browser";
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
...
import { environment } from "../environments/environment";
import { AngularFireModule } from "@angular/fire";
import { AngularFirestoreModule } from "@angular/fire/firestore";
import { AngularFireFunctionsModule } from '@angular/fire/functions';
import { ExamplesFirebaseFunctionsComponent } from './examples/firebase-functions.component';
@NgModule({
declarations: [
...
ExamplesFirebaseFunctionsComponent,
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
...
AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule,
AngularFireFunctionsModule,
...
],
providers: [],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
import { Component } from "@angular/core";
import { AngularFireFunctions } from "@angular/fire/functions";
import { map } from 'rxjs/operators';
@Component({
selector: "examples-firebase-functions",
template: `
<h1>FireBase Functions Example</h1>
<pre>{{ data$ | async }}</pre>
`,
})
export class ExamplesFirebaseFunctionsComponent {
data$;
constructor(private fns: AngularFireFunctions) {
const callable = fns.httpsCallable("transpon");
this.data$ = callable({ songId: "170180" }).pipe(
map((text: any) => {
console.log(text.transformed); // return value
return "test";
})
);
}
}
Duplicate of #2452 and #2444
Zone issues have been patched in affunctions.