external-service-details.component.ts 1.3 KB

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