import { HttpClient } from '@angular/common/http'; import { AuthServiceService } from './../../shared/auth-service.service'; import { ActivatedRoute, Params } from '@angular/router'; import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-inernal-service-page', templateUrl: './inernal-service-page.component.html', styleUrls: ['./inernal-service-page.component.css'] }) export class InernalServicePageComponent implements OnInit { constructor(private route: ActivatedRoute, private authSer: AuthServiceService, private http: HttpClient) { } serviceId: number; serviceData = []; ngOnInit() { this.route.params.subscribe( (params:Params) => { this.serviceId = params['externalServiceId']; }, (error) => { console.log(error); } ); this.http.get(this.authSer.pathApi + '/get_external_service/' + this.serviceId).subscribe( (responce) => { console.log(responce); this.serviceData = responce['external_service']; }, (error) => { console.log(error); } ); } }