Служба событий:
Код: Выделить всё
public GetAllEventsCardInfo() : Observable {
return this.http.get("https://localhost:7034/Event");
}
home-page.ts
Код: Выделить всё
@Component({
selector: 'app-home-page',
imports: [EventDisplayCard, RecipientDisplayCard, EventAddModule, MatIconModule, RecipientAddModal, AsyncPipe],
templateUrl: './home-page.html',
styleUrl: './home-page.css'
})
export class HomePage {
events$ : Observable = of([]);
recipients : RecipientSummaryInfo[] = [];
addModalVisible : boolean = false;
addRecipientVisible : boolean = false;
constructor(private eventService : EventService) { }
ngOnInit() {
this.events$ = this.eventService.GetAllEventsCardInfo();
}
}
Код: Выделить всё
@for (event of events$ | async; track event.Id){
} @empty {
No events found! Add an event to get started!
}
event-display-card.html
Код: Выделить всё
{{ EventInfo.Name }}
{{ EventInfo.EventDate.toLocaleDateString() }}
Если кто-то может помочь мне обучить меня, я буду очень признателен. Я очень хорошо разбираюсь в настройках серверной части, но это моя первая попытка создания внешнего приложения.
Код: Выделить всё
export class EventInfo {
public Id: string = "";
public Name: string = "";
public EventDate: Date = new Date();
public Budget: number = 0;
};
Код: Выделить всё
[{
"id":"019c9136-a438-72bb-b983-76a1b4d3b514",
"name":"test",
"budget":220,
"eventDate":"2026-02-10T18:00:00-06:00"
}]
Подробнее здесь: https://stackoverflow.com/questions/798 ... et-request
Мобильная версия