import { Component, OnInit, signal } from '@angular/core'; import { Expense, ExpenseService } from '../../services/expense.service'; import { ExpenseComponent } from '../expense/expense.component'; import { Category, CategoryService } from '../../services/category.service'; import { SubCategory, SubCategoryService } from '../../services/sub-category.service'; import { Merchant, MerchantService } from '../../services/merchant.service'; import { Tag, TagService } from '../../services/tag.service'; @Component({ selector: 'app-expense-list', imports: [ ExpenseComponent ], templateUrl: './expense-list.component.html', styleUrl: './expense-list.component.scss', }) export class ExpenseListComponent implements OnInit { protected expenses = signal([]); protected categories = signal([]); protected subCategories = signal([]); protected merchants = signal([]); protected tags = signal([]); public constructor(private readonly expensesService: ExpenseService, private readonly categoryService: CategoryService, private readonly subCategoryService: SubCategoryService, private readonly merchantService: MerchantService, private readonly tagService: TagService) { } public ngOnInit() { // this.expensesService.getExpenses().then(expenses => { // console.log({ expenses }); // TODO: remove me // this.expenses.set(expenses); // }); Promise.all([ this.expensesService.getExpenses(), this.categoryService.getCategories(), this.subCategoryService.getSubCategories(), this.merchantService.getMerchants(), this.tagService.getTags() ]).then(([expenses, categories, subCategories, merchants, tags]) => { console.log({ expenses, categories, subCategories, merchants, tags }); // TODO: Remove me this.expenses.set(expenses); this.categories.set(categories); this.subCategories.set(subCategories); this.merchants.set(merchants); this.tags.set(tags); }) } }