inernal-service-page.component.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { HttpClient } from '@angular/common/http';
  2. import { AuthServiceService } from './../../shared/auth-service.service';
  3. import { ActivatedRoute, Params } from '@angular/router';
  4. import { Component, OnInit } from '@angular/core';
  5. @Component({
  6. selector: 'app-inernal-service-page',
  7. templateUrl: './inernal-service-page.component.html',
  8. styleUrls: ['./inernal-service-page.component.css']
  9. })
  10. export class InernalServicePageComponent implements OnInit {
  11. constructor(private route: ActivatedRoute,
  12. private authSer: AuthServiceService,
  13. private http: HttpClient) { }
  14. serviceId: number;
  15. serviceData = [];
  16. ngOnInit() {
  17. this.route.params.subscribe(
  18. (params:Params) => {
  19. this.serviceId = params['externalServiceId'];
  20. },
  21. (error) => {
  22. console.log(error);
  23. }
  24. );
  25. this.http.get(this.authSer.pathApi + '/get_external_service/' + this.serviceId).subscribe(
  26. (responce) => {
  27. console.log(responce);
  28. this.serviceData = responce['external_service'];
  29. },
  30. (error) => {
  31. console.log(error);
  32. }
  33. );
  34. }
  35. }