-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom AJAX implementation / adapters #311
Comments
Did some research. Experimental implementation: |
@AlekseyMartynov is there any planned data on support proper Angular HttpClient usage? We use Angular http interceptors extensively in our project so this is a major problem in switching from Telerik (which is all native angular code) to DevExtreme. I see you have an experimental branch but wondering when this would be released/fixed? thank you! |
@pwen090 |
@AlekseyMartynov, and what about AngularJS? Right now we're using a tweaked version of dx.aspnet.data.js where all ajax calls replaced with $http service... |
@Bykiev currently no plans to support |
@AlekseyMartynov, thx, but you should consider to implement universal mechanism to bypass this issue, it's really annoying to support our own custom implementation, because interceptors are really useful in Angular/AngularJS apps. |
If DevExtreme is referenced as a module (via DevExtreme.AspNet.Data/experiments/ng-http-client-fixture.js Lines 21 to 29 in 37e4de7
If you use dx.all.js then I think we can expose |
@AlekseyMartynov, no, we're not using |
@AlekseyMartynov how would we use the experimental code you linked to above in our regular Angular project? |
Correct. Without @pwen090 |
@Bykiev |
Please check the sample app at https://github.com/DevExpress/DevExtreme.AspNet.Data.NgHttpClientSample. |
@AlekseyMartynov, thx! Do you have any sample how to use it with AngularJS? |
No, we don't. I can only suggest an outline: // execute on app start
DevExpress.utils.ajax.inject({
sendRequest: function(options) {
var d = $.Defered();
...
// on success
d.resolve(responseBody, "success", xhr);
// on error
d.reject(xhr, "error");
...
return d.promise();
}
});
|
@AlekseyMartynov, do I understand you correctly, after injecting my logic into
If so, it's not working for me,
|
@Bykiev Thanks for trying it out. Looks like the jQuery-based dx.aspnet.data script requires additional modifications to support custom AJAX. I'll check it and post an update. |
@Bykiev Please try a custom version of dx.aspnet.data.js with |
@AlekseyMartynov, this version is working fine :) |
Is it supposed to work with Axios? |
Hello @ehouarn-perret. |
I managed to make it work but it's kind clunky. Will post something here later on. |
According to this DevExpress/DevExtreme.AspNet.Data#311 (comment) you should return xhr value to resolve/reject promise
Hi @AlekseyMartynov , this sample seems to be working incorrectly, because xhr value passed to resolved promise is always null. I've created a pull request |
According to this DevExpress/DevExtreme.AspNet.Data#311 (comment) you should return xhr value to resolve/reject promise
Is there any update on when there will just be built in support for Angular instead of having to do the ng-http-client-helper.ts style workarounds? |
+1 it will be cool to include it into angular-devextreme package |
I wish I could have the built-in support too. Our DevExtreme framework integration team has this task on the list, but its priority is not very high because of the existing workaround. We'll make an announcement when the feature is ready. Thanks for all your help! |
Hi all; Can you somehow implemented refresh-token operation with DevExtreme.AspNet.Data in Angular? I tried some ways but couldn' t succeed it. If we get an 401 error with a request created by DevExtreme.AspNet.Data, i cannot do the operations which i' ve already implemented in http.interceptor. (If we got an 401 error, generate a refresh-token request, if everything is ok, send the failed requests again) |
@AlekseyMartynov, hello! It seems with the latest version of devextreme such adapter is not being called anymore (issue with injecting). Can you please check it? |
Hello @Bykiev DevExtreme has changed the module structure in 21.1. You'll need to edit the |
Thank you! |
Hello @AlekseyMartynov, in the newest devextreme version the The sample app (https://github.com/DevExpress/DevExtreme.AspNet.Data.NgHttpClientSample) still uses the Deferred function and is not updated to [email protected]. Is there already a new way how to use the HttpClient from Angular? |
Any news on this matter by any chance ? |
In all honesty feedback on this would be really important. |
Frequent question is how to use Angular's HttpClient for AJAX.
The text was updated successfully, but these errors were encountered: