feat: started details page
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { AfterViewInit, Component } from "@angular/core";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { Data } from "../../services/parsers/rulib/rulib.detail.dto";
|
||||
import { SearchService } from "../../services/search.service";
|
||||
|
||||
@Component({
|
||||
selector: "app-detail",
|
||||
templateUrl: "./detail.component.html",
|
||||
styleUrls: ["./detail.component.less"],
|
||||
standalone: true,
|
||||
imports: [CommonModule],
|
||||
})
|
||||
export class DetailComponent implements AfterViewInit {
|
||||
detail_item: Data | null = null;
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private searchService: SearchService,
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
const url = params["url"];
|
||||
if (url) {
|
||||
this.searchService.getDetails(url).subscribe((data) => (this.detail_item = data.data));
|
||||
} else {
|
||||
this.router.navigate(["/"]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user