-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathcity-card.component.ts
More file actions
35 lines (31 loc) · 948 Bytes
/
city-card.component.ts
File metadata and controls
35 lines (31 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Component, OnInit } from '@angular/core';
import { CityStore } from '../../data-access/city.store';
import { FakeHttpService } from '../../data-access/fake-http.service';
import { CardType } from '../../model/card.model';
import { City } from '../../model/city.model';
import { CardComponent } from '../../ui/card/card.component';
@Component({
selector: 'app-city-card',
template: `
<app-card
[list]="cities"
[type]="cardType"
[image]="image"
customClass="bg-light-red"></app-card>
`,
standalone: true,
imports: [CardComponent],
})
export class CityCardComponent implements OnInit {
cities: City[] = [];
image = 'city.png';
cardType = CardType.CITY;
constructor(
private http: FakeHttpService,
private store: CityStore,
) {}
ngOnInit(): void {
this.http.fetchCities$.subscribe((s) => this.store.addAll(s));
this.store.cities$.subscribe((s) => (this.cities = s));
}
}