angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Firebase Function not working

Open alekcey0211 opened this issue 6 years ago • 2 comments

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";
      })
    );
  }
}

alekcey0211 avatar May 16 '20 13:05 alekcey0211

Duplicate of #2452 and #2444

crtl avatar May 18 '20 13:05 crtl

Zone issues have been patched in affunctions.

jamesdaniels avatar Nov 13 '20 01:11 jamesdaniels