feat: getting details of manga
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { Component } from "@angular/core";
|
||||
import { RouterModule } from "@angular/router";
|
||||
import { AfterViewInit, Component } from "@angular/core";
|
||||
import { ActivatedRoute, Router, RouterModule } from "@angular/router";
|
||||
import { AppService } from "./app.service";
|
||||
import { HeaderComponent } from "./components/header/header.component";
|
||||
import { LibSocialParserService } from "./services/parsers/rulib/lib.social.parser.service";
|
||||
import { Datum } from "./services/parsers/rulib/rulib.dto";
|
||||
import { SearchService } from "./services/search.service";
|
||||
|
||||
@@ -14,13 +13,14 @@ import { SearchService } from "./services/search.service";
|
||||
styleUrl: "./app.component.less",
|
||||
providers: [AppService],
|
||||
})
|
||||
export class AppComponent {
|
||||
export class AppComponent implements AfterViewInit {
|
||||
title = "NwaifuAnime";
|
||||
items: Datum[] = [];
|
||||
constructor(
|
||||
private sw: AppService,
|
||||
private parser: LibSocialParserService,
|
||||
private searchService: SearchService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
get hasUpdate() {
|
||||
@@ -36,6 +36,19 @@ export class AppComponent {
|
||||
}
|
||||
|
||||
onSearch(text: string) {
|
||||
const currentParams = this.route.snapshot.queryParams;
|
||||
const newParams = { ...currentParams, search: text };
|
||||
this.router.navigate([], { queryParams: newParams });
|
||||
this.searchService.search(text);
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
console.log(params);
|
||||
const searchParam: string | undefined = params["search"];
|
||||
if (searchParam) {
|
||||
this.searchService.search(searchParam);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user