import { Component } from '@angular/core';
import { ApiService } from "../../shared/services/api.service";
import { AsyncPipe, CommonModule } from "@angular/common";

@Component({
  selector: 'app-info',
  standalone: true,
  imports: [
    AsyncPipe,
    CommonModule
  ],
  templateUrl: './info.component.html',
  styleUrl: './info.component.scss'
})
export class InfoComponent {
  data$ = this.api$.data$;
  constructor(private api$: ApiService) {}

  getAddress(item: any): string{
    if (item){
      return [item.address, item.ward, item.district, item.city].filter(Boolean).join(", ");
    }
    return 'không xác định';
  }
}
