alferesw

Homelateral.component.ts

Dec 10th, 2023
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. import { Component } from '@angular/core';
  2. import { BlogService } from '../../../services/blog.service';
  3. import { GobalConstants } from 'src/app/gobal-constants';
  4.  
  5.  
  6. @Component({
  7. selector: 'app-homelateral',
  8. templateUrl: './homelateral.component.html',
  9. styleUrls: ['./homelateral.component.css']
  10. })
  11. export class HomelateralComponent {
  12.  
  13. recientes: any[] = [];
  14. url = GobalConstants.urlServer;
  15. isPromiseResolved: any;
  16. configCountry: any;
  17.  
  18. constructor ( private blogService: BlogService){
  19. console.log("cargar vic")
  20. }
  21.  
  22. ngOnInit(){
  23.  
  24.  
  25. /* this.blogService.getPromise().then(() => {
  26. this.Afterpromise();
  27. }); */
  28. this.blogService.getConfigCountry().subscribe(configCountry => {
  29. this.configCountry = configCountry;
  30. this.Afterpromise();
  31. console.log('Info actualizada:', this.configCountry);
  32. });
  33.  
  34.  
  35. this.blogService.getRecientes()
  36. .subscribe((resp) => {
  37. if(resp){
  38. this.recientes = resp;
  39. }else{
  40. alert("Es un error");
  41. }
  42. })
  43.  
  44. }
  45.  
  46. Afterpromise(): void {
  47.  
  48. console.log('Depues de la consulta');
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment