HttpErrorResponse {headers: HttpHeaders, status: 404, statusText: "Not Found"

i have a little worry, if some can just help me, i use a laravel 5.8 api, which i create, when i retrieve the parameter data mtr from posteman its walk, but when i do the same thing with this url << url = ‘http://127.0.0.1:8000/api/studentbyid/45’ >> it works its problem because the 45 is the mtr, whereas according to the logic that I try to put in place and that it is the user who will introduce the mtr, then display…

import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Candidate } from '../models/candidate';

@Component({
  selector: 'app-candidate',
  templateUrl: './candidate.page.html',
  styleUrls: ['./candidate.page.scss'],
})
export class CandidatePage implements OnInit {
  mtr: '45';
  // tslint:disable-next-line: new-parens
  data: any;
  url = 'http://127.0.0.1:8000/api/studentbyid/';
  constructor( private httpClient: HttpClient) { }


  ionViewWillEnter(mtr: string) {
    return this.httpClient.get(this.url + '/' + this.mtr)
    .subscribe(data => {
      this.data = JSON.stringify(data);
      console.log(this.data);
 }), error => {
    console.log(error);
};
   }
  ngOnInit() {}

  getbyID( mtr: string) {
  
  }
}

here is the result in the console when I place it directly

Capture1
and that’s when I try to retrieve the word from a user
Capture
if there are some who can just help me, and I notice that there is no answer in the form of object
[1]: https://i.stack.imgur.com/ghT6L.png
[2]: https://i.stack.imgur.com/mStY0.png

If you haven’t already, please read the Tour of Heroes HttpClient chapter before continuing.

OK, that should give you enough information to complete the following exercise:

  1. Rewrite things so that pages never inject HttpClient. They are only allowed to inject services. The service will inject HttpClient and do all the interaction with it.

  2. All methods must have types for all parameters and return values. any is not allowed anywhere in app code. Figuring out what the proper return value type for various functions needs to be is a crucial part of this exercise.

  3. The service can have no modifiable instance properties. So you can inject HttpClient in the constructor, and define constants like url, but it is forbidden to try to put mtr into an instance property (assuming that I’m reading your description correctly, and mtr is not a constant, but rather something that gets determined at runtime).

This may all seem silly and arbitrary now, but I strongly believe that if you take the time to go through the exercise, lots of fundamental concepts that you don’t really feel confident about now will suddenly make a lot more sense.

merci, j’ai déjà trouvé une solution !