feat: demo manga search
This commit is contained in:
@@ -1 +1,7 @@
|
||||
<h1>It's home component</h1>
|
||||
@for (item of items; track $index) {
|
||||
<div class="card">
|
||||
<h1>{{ item.rus_name }}</h1>
|
||||
<img [src]="item.cover.thumbnail" [alt]="item.slug" />
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component } from "@angular/core";
|
||||
import { Component, Input, OnDestroy, OnInit } from "@angular/core";
|
||||
import { Subscription } from "rxjs";
|
||||
import { Datum } from "../../services/parsers/rulib/rulib.dto";
|
||||
import { SearchService } from "../../services/search.service";
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
@@ -8,4 +11,19 @@ import { Component } from "@angular/core";
|
||||
styleUrls: ["./home.component.less"],
|
||||
imports: [CommonModule],
|
||||
})
|
||||
export class HomeComponent {}
|
||||
export class HomeComponent implements OnInit, OnDestroy {
|
||||
@Input() items: Datum[] = [];
|
||||
private subscription: Subscription = new Subscription();
|
||||
|
||||
constructor(private searchService: SearchService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.subscription = this.searchService.currentItemsTerm.subscribe((data) => {
|
||||
this.items = data;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user