389 questions
0
votes
2
answers
598
views
Angular 8.3.20 HttpClient refuse/fail while response returns 200 OK
I have create my api/product-search.php backend in http://localhost/ like so:
<?php
header('Access-Control-Allow-Origin', '*');
header("Access-Control-Allow-Headers: Content-Type");
header("Access-...
-2
votes
1
answer
56
views
when ad add code on my file as it is on video i get error "./src/app/app.module.ts Module not found: Error: Can't resolve '@angular/http'"
i am new in angular world. i trying to learn this framework but it is so HARD!... so in my first example i got error:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } ...
2
votes
1
answer
220
views
Rxjs Async Interceptors - Keep on getting an error
I need to add a token to the request in my interceptor. I keep on getting the error
core.js:1673 ERROR TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, ...
-1
votes
1
answer
204
views
HTTP Response handling in angular 2 application
Working with angular 2 HTTP PUT request. I have a component and service. In the component I make request to update the attributes of account. It then calls the Service to update the account through ...
1
vote
1
answer
4k
views
Angular 2, v6: Write on assets/*.json file and save it [Typescript]
:)
I have an Angular application (@angular/cli: ~6.0.3, typescript: ~2.7.2) which have a json file in assets folder.
I'm trying to access this json file, write on it and save it.
How can I do that?
...
0
votes
1
answer
427
views
how to access complex json object angular 2
//component.ts
public items: any;
getResult(){
var jsonBody = {};
jsonBody['activity'] = this.activity;
jsonBody['seatnumber'] = this.seatNo;
this.localService.postCall(jsonBody)
...
0
votes
1
answer
37
views
can get data out of http request
i have a problem receiving data to variable.
this works:
this.http.get(some_url).subscribe(
data => {
console.log(JSON.parse(data['_body']))
});
but if i try to get ...
2
votes
1
answer
752
views
Notifying user when service returns, after routing to another component
I have a service that takes too long to return. Once the user has submitted a request, he/she should be able to navigate to any other page.
How can I alert her that the request she submitted has ...
2
votes
2
answers
8k
views
Angular makes http request Twice
I have a mean stack going. Angular 5.
I'm grabbing data from a form and i'm calling a Service to handle sending the form-data to the backend api.
The service makes use of the HttpClient. It sends ...
0
votes
0
answers
36
views
Angular5 Http Request with process tracking somehow breaks routes
I am facing a very strange problem. I implemented a file upload function for PDFs with REST api and track the upload process like that.
My upload function looks like this:
upload(){
this....
-1
votes
1
answer
83
views
Angular 2/4: Is it safe to use Http.Get (with parameters) when calling WebApis?
In Angular, is it secure to use Http Get when calling Web API, supplying password in the field? Or is it more secure if one uses Http Post?
The following is an example on how to perform Http.get in ...
3
votes
1
answer
4k
views
How to set HttpParams in a compact way similar to HttpHeaders in Angular [duplicate]
I am rather new to Angular and now am upgrading from "the old" Http API to the new HttpClient API.
Therefor I have to use the new HttpHeaders and HttpParams, which works fine so far. But the ...
0
votes
2
answers
660
views
Error converting json response to an array in angular 2
I am trying to convert a json response into an array in angular 2. The following is the code i have used,
.ts file
response;
resp;
constructor(private http:Http) {
}
get()
{
...
0
votes
2
answers
73
views
Seach when input is not empty and with delay for typing complete
I want to call service only when user input is not empty and ith some delay so user finish the typing.
Below is the code. Please help.
Component.ts
searchByName(event) {
this.facilityService....
0
votes
2
answers
93
views
Angular4 variations of different status codes?
My Api is giving me different types of status codes for warnings and errors. I have to show different alerts based on response.
I am calling http service like this:
service.ts
@Injectable()
export ...
1
vote
1
answer
291
views
Angular2 observable timeout
I have a ASP.NET core web application with angular2 for client-facing.For specific reasons I want to increase the timeout of Http calls from angular2 to back-end server from default to 8 minutes.I ...
1
vote
0
answers
1k
views
Large Files Uploading on Angular 4+ to Django
Currently I am uploading file using angular2-http-file-upload and send it to django back-end and it work fine with small files here is how I done it but when uploading large file 35Mb-600Mb its ...
0
votes
1
answer
3k
views
Angular 2: ERROR TypeError: .. is not a function
I am trying to use angualrio to read from an array from a json file following this tutorial getting-started-with-angular-2-step-by-step-6-consuming-real-data-with-http/.
However I am getting the ...
2
votes
1
answer
2k
views
Observable finally not getting fired
This works:
this.http.get('/doesntexist1')
.finally(() => console.log('finally1'))
.subscribe(() => { });
But this doesn't:
const obs = this.http.get('/doesntexist2');
obs.finally(() => ...
6
votes
4
answers
6k
views
Angular: How to know if request has been cancelled in HttpClient
To know if a request has completed, I do if (httpEvent instanceof HttpResponse). Likewise, how to know if a request is cancelled in HttpInterceptor? Below is my intercept function.
intercept(...
3
votes
0
answers
2k
views
Angular: Resolver delays component load even after the service has returned
I have some data that has to be loaded before the page loads and I'm using route resolvers to achieve this. Below is my code.
Service:
getUsernamesAndBUs(): Observable<any> {
return ...
1
vote
3
answers
1k
views
Ionic 3 http post request invalid HTTP status code 403 while jQuery ajax post is working perfectly
I am working on a mobile app. I need to fetch some data from WordPress website but the http request always through error Response for preflight has invalid HTTP status code 403
Typescript
this._http....
1
vote
0
answers
528
views
Angular2 static HTTP client
I want to use static HTTP client service for some reasons. I tried it like the following but I got an error. Is creating static the service possible?
static service:
import { Http, URLSearchParams, ...
-1
votes
1
answer
915
views
angular 2 how to get returned data from .post http angular2
I am using HTTP angular2 to post some data. It is working ok, I can send data from angular2 service , receive it in my express backend.
I want to get the returned data from express. If i use .get ....
0
votes
0
answers
47
views
how to intecept custom http in angular2
i create a custom http extends HttpInterceptor, like this:
@Injectable()
export class AuthInterceptor implements HttpInterceptor {
constructor(private router:Router,
private store: ...