Last active
September 20, 2019 09:01
-
-
Save xErik/ffaccc54f498b36f99900d100fb49433 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./src/app/functionstest/functionstest.tl | |
import { Component, OnInit } from '@angular/core'; | |
import { AngularFireFunctions } from '@angular/fire/functions'; | |
@Component({ | |
selector: 'app-functiontest', | |
template:'<p style="border:1px red solid;margin-top:50px">{{ out }}x</p>' | |
}) | |
export class FunctiontestComponent implements OnInit { | |
constructor(private func: AngularFireFunctions) {} | |
out:string =''; | |
ngOnInit() { | |
this.func.httpsCallable('helloWorld')({ text: 'Some Argument' }) | |
.toPromise() | |
.then(resp => { | |
console.log( resp ); | |
this.out = JSON.stringify(resp); | |
}) | |
.catch(err => { | |
console.error({ err }); | |
}); | |
} | |
} | |
// ./functions/src/index.ts | |
import * as functions from 'firebase-functions'; | |
export const helloWorld = functions.https.onCall((data, context) => { | |
return { message: "Hello from Firebase!" }; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment