Advertisement
Sub0Zero1990

Untitled

Feb 21st, 2025
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export class HomeComponent {
  2.   public imagesPath: String[] = [];
  3.  
  4.   constructor(private http: HttpClient) { }
  5.  
  6.   public async search(e: Event) {
  7.     const input = e.target as HTMLInputElement;
  8.  
  9.     this.imagesPath = [];
  10.  
  11.     const response = await firstValueFrom(this.http.get<{data: {imagesPath: String[]}}>
  12.       ('/manga/get', { params : { title: input.value } }).pipe(
  13.         tap(res => {
  14.           console.log(res.data.imagesPath)
  15.         })
  16.       ));
  17.  
  18.     this.imagesPath = response.data.imagesPath;
  19.  
  20.     console.log(this.imagesPath);
  21.     console.log(this.imagesPath.length);
  22.   }
Tags: angular
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement