0

have an angular project with a method :

createUSer() {
  let params = new HttpParams()
  params.append("email","sdfsd@sdsvvvvdf.com")
  params.append("password","sdfdfd121")

  this.htpClien.get(this.baseUrsl+"createEmployee",
  {params:params}).subscribe(sub=>{
  })
}

and a function in my firebase functions:

exports.createEmployee = functions.https.onRequest((request, response)=>{

    if (request.method === 'GET') {

        let email = request.query.email;
        let password = request.query.password;

            admin.auth().createUser({
                email: email,
                emailVerified: false,
                password: password,
                disabled: false
            }).then(succes => {
                response.send(succes.uid)
            }).catch(er => {
                response.send(er)
            })        
    }
});

when testing it trough "postman" everything works like it should but when I fire it trough Angular I get "undefined" values of email and password ... what am I doing wrong?:S

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
pb4now
  • 1,305
  • 4
  • 18
  • 45
  • https://angular.io/api/common/http/HttpParams Notice the line: `This class is immutable - all mutation operations return a new instance.` – AT82 Mar 21 '18 at 13:45
  • @Alex ty but...should I use "set" instead of "append"? - see that U linked to another simiular question but the answer there is still unclear for me :S -how should it be set up in that case? – pb4now Mar 21 '18 at 13:53
  • 1
    Well with the link to the docs shows the difference between `set` and `append`. I usually use `set` myself :) You just need to do `let params = new HttpParams().set(...)` (or user `append`) like the answer in the duplicate question shows. Currently you are just creating new instance. – AT82 Mar 21 '18 at 13:58
  • @Alex aha now I get it -ty:) will try it- ( btw can not mark this aanswer as a correct one for some reason and can only upvote it :s) – pb4now Mar 21 '18 at 14:03

0 Answers0