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
and that’s when I try to retrieve the word from a user
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