0

I want to receive URL parameters of these frames :

"GET /Reception?ID=00-80-00-00-00-00-d5-ef&Voltage=8 HTTP/1.1 Host: www.quatuoradbd.com"

or

"GET /Reception/00-80-00-00-00-00-d5-ef/8 HTTP/1.1 Host: www.quatuoradbd.com"

The host is a example, it is your domaine name

but I do not understand why I can not do it. I use queryParams or snapshot for receiving parameters of URL in function of the frame sent.

Here my project on Github: https://github.com/Sauniere/test

Damien Snr
  • 15
  • 3

1 Answers1

0

If you want to use this format "GET /Reception?ID=00-80-00-00-00-00-d5-ef&Voltage=8"

var q = {
    ID: ID,
    Voltage : Voltage
};
this._router.navigate(['/Reception'], {
    queryParams: q
});

And your route will be just 'Reception' in route module

if you want to use another "GET /Reception/00-80-00-00-00-00-d5-ef/8" just define Reception/:ID/:Voltage which you're doing.

this.ID = this.route.snapshot.params['ID'];
this.Voltage = this.route.snapshot.params['Voltage'];
Rakesh Chand
  • 3,105
  • 1
  • 20
  • 41
  • These frames from a microcontroller. Is it different? Because when I put "http://localhost:4200/Reception?ID=00-80-00-00-00-00-d5-ef&Voltage=8" or "http://localhost:4200/Reception/00-80-00-00-00-00-d5-ef/8" in URL's bar it works fine with snapshot or queryParams. But when I send this frame from microcontroller "GET /Reception?ID=00-80-00-00-00-00-d5-ef&Voltage=8 HTTP/1.1 Host: www.quatuoradbd.com" it doesn't work – Damien Snr Feb 15 '18 at 11:20