Tag : typescript

I’m using Angular 11 and I’m trying to pass parameters to backend with right type (the type I need on the backend side) to my @GetMapping controller. If I try to do: getData(page: Number, firstId: Number, secondId: Number): Observable<AirpollData[]> { let params = new HttpParams(); params = params.append(‘page’, page); // #1 params = params.append(‘firstId’, firstId); ..

Read more

Initial situation I want my http response as HttpResponse object. So that I can access the body or the http status code as httpResponse.body or httpResponse.status. The code for it, which does exactly what I want to achieve: public async register(userSignUpData: unknown): Promise<User> { const httpOptions = { observe: ‘response’ as ‘response’, headers: new HttpHeaders({ ..

Read more

I need to call this api: insertATT(id: string, name: string, file: File): Observable<Object[]> { const httpOptions = { } const formData = new FormData(); formData.append(‘id’, id); if (Utility.isNotNull(file[0])) { formData.append(‘n1’, name); formData.append(‘f1’, file); } return this.http.post(‘insert’, formData, httpOptions).pipe(map( (response: Object[]) => {console.log(response); return response }, ), catchError((error) => { return throwError(error); })); } The call: ..

Read more

I am using a dependency which itself depends on isomorphic-unfetch. In an Angular 11 project, I can execute isomorphic-unfetch itself without any errors. When using the dependency (installed via npm), which internally uses isomorphic-unfetch to fetch, I receive the following message: index.js:209 TypeError: Failed to execute ‘fetch’ on ‘Window’: Illegal invocation at zone-evergreen.js:1465 at Object.proto.<computed> ..

Read more

I’m working my way into Angular. I am building a CSV file reader, to compare two kinds of csv data files. For this I have two component with almost identical setup, only the data is processed differently. Therefore part of both components are identical. It worked fine yesterday, but today after installing lodash-es ng serve ..

Read more