Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- const id = this.actRoute.snapshot.paramMap.get('id');
- this.studentApi.GetStudent(id).subscribe((res: any) => {
- console.log(res.data);
- this.subjectArray = res.data;
- console.log(this.subjectArray);
- this.studentForm = this.fb.group({
- id: [res.id, [Validators.required]],
- domain_id: [res.domain_id, [Validators.required]],
- source: [res.source, [Validators.required]],
- destination: [res.destination]
- });
- });
- }
- GetStudent(id): Observable<any> {
- const API_URL = `${this.endpoint}/read-student/${id}`;
- return this.http.get(API_URL, { headers: this.headers })
- .pipe(
- map((res: Response) => {
- return res || {};
- }),
- catchError(this.errorMgmt)
- );
- }
- studentRoute.get('/read-student/:id', (request, response) => {
- const id = request.params.id;
- con.query('SELECT * FROM students WHERE id = ?', id, (error, result) => {
- if (error) throw error;
- response.send(result);
- });
- });
- [
- {
- "id": 5,
- "domain_id": 2,
- "source": "tester0700@test.pl",
- "destination": "testw@test.pl"
- }
- ]
- this.studentApi.GetStudent(id).subscribe((res: any) => {
- console.log(res);
- this.subjectArray = res;
- // handle the rest here.
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement