MiniProfiler and AngularJS

I recently tried to process ASP MVC methods called using the AngularJS $ http service, and I noticed that MiniProfiler does not update the data, as it does for AJAX calls from jQuery, for example.

Is there a way to use MiniProfiler with Angular?

+6
source share
2 answers

This problem was addressed by this transfer request and was fixed in the current MiniProfiler.

+1
source

Correction required for Angular (1.3.10)

(not required if you are using another library for your XHR needs)

MiniProfiler does this with XMLHttpRequest to be able to intercept all XHR calls for angular

XMLHttpRequest.prototype.send = function sendReplacement(data) { if (this.onreadystatechange) { ... 

Well, Angular never installs xhr.onreadystatechange, so we need to handle this in a harmless way:

 function createXhr() { var xhr = new window.XMLHttpRequest(); xhr.onreadystatechange = function () { }; return xhr; } 

Explained in detail here

+5
source

Source: https://habr.com/ru/post/986152/


All Articles