angular4-httpclient

How to make a massive delete in angular 4 with an array of ids

人盡茶涼 提交于 2021-02-20 04:12:33
问题 I'm trying to make a massive delete, in order to do that I have an Array<number> of the ids I want to delete. I can't pass this array as a parameter to the method this._httpService.delete(uri,options) . The type of _httpService is Http . So I'm looping the array and inside the loop I'm making single calls, but each call is async and I have certain logic to run when the loop ends. 回答1: Actually you can send the id array in the body of a DELETE request, according to this answer, like so: http

How to make a massive delete in angular 4 with an array of ids

情到浓时终转凉″ 提交于 2021-02-20 04:08:05
问题 I'm trying to make a massive delete, in order to do that I have an Array<number> of the ids I want to delete. I can't pass this array as a parameter to the method this._httpService.delete(uri,options) . The type of _httpService is Http . So I'm looping the array and inside the loop I'm making single calls, but each call is async and I have certain logic to run when the loop ends. 回答1: Actually you can send the id array in the body of a DELETE request, according to this answer, like so: http

How to make a massive delete in angular 4 with an array of ids

匆匆过客 提交于 2021-02-20 04:06:29
问题 I'm trying to make a massive delete, in order to do that I have an Array<number> of the ids I want to delete. I can't pass this array as a parameter to the method this._httpService.delete(uri,options) . The type of _httpService is Http . So I'm looping the array and inside the loop I'm making single calls, but each call is async and I have certain logic to run when the loop ends. 回答1: Actually you can send the id array in the body of a DELETE request, according to this answer, like so: http

How to make a massive delete in angular 4 with an array of ids

倾然丶 夕夏残阳落幕 提交于 2021-02-20 04:05:13
问题 I'm trying to make a massive delete, in order to do that I have an Array<number> of the ids I want to delete. I can't pass this array as a parameter to the method this._httpService.delete(uri,options) . The type of _httpService is Http . So I'm looping the array and inside the loop I'm making single calls, but each call is async and I have certain logic to run when the loop ends. 回答1: Actually you can send the id array in the body of a DELETE request, according to this answer, like so: http

Interceptors only for specific Service

烈酒焚心 提交于 2021-01-02 05:07:09
问题 I have several services in my app that point to different API URLs. Now I need to set different headers to each of these services. My question is now regarding the new interceptors in Angular 4. Is there a possibility to set one interceptor for a specific service? So each service has its specific interceptor? Hopefully, you guys get my question. 回答1: TL:DR Answer: No there is no way. An interceptor is designed to intercept all requests. Long Answer: A repository nor a request shouldn't be

Interceptors only for specific Service

时光毁灭记忆、已成空白 提交于 2021-01-02 05:06:00
问题 I have several services in my app that point to different API URLs. Now I need to set different headers to each of these services. My question is now regarding the new interceptors in Angular 4. Is there a possibility to set one interceptor for a specific service? So each service has its specific interceptor? Hopefully, you guys get my question. 回答1: TL:DR Answer: No there is no way. An interceptor is designed to intercept all requests. Long Answer: A repository nor a request shouldn't be

getting variable data outside subscribe method

本小妞迷上赌 提交于 2020-01-15 07:09:07
问题 I am trying to implement canActivate for user routes, before that I want to check whether the access token is still valid or not. Therefore I implement something like this export class AuthGuard implements CanActivate { data:Array<Object>; constructor(private base: BaseService){} canActivate( next: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { var session: any = { token: localStorage.getItem('abc') }; this.base.valid(session).subscribe(result => { this.data=result; console

angular 2/4 multiple drop down

走远了吗. 提交于 2020-01-13 06:48:27
问题 I am trying to develop two drop downs in my Angular application. The 1st one is shop list and the other one is godown list . When I select a shop it will show it on data.but when I select Godown it's not changing data. Here I have two drop down boxes. I think my problem is in my typescript file(Onselect) because here I have 2 drop downs(in html I use 2 Onselect function but in my ts file have only one function). I'm just a beginner in Angular , so I would appreciate any comments on downsides