I have an avatar that mounts with SVG files, the problem is that it gets disassembled before status 200. How could I capture the status (pending) only after it loads displaying the avatar?
Example where the avatar hair is rendered in the HTML view:
<!-- cabelo -->
<div class="hair" ng-if="avatarUser.hair != null" ng-class="avatarUser.hair.model">
<div class="hair-color">
<div ng-bind-html="resultSVG.hair"></div>
</div>
</div>
The service that converts the URL to the avatar's HTML content:
this.convertAvatar = function(url_svg, $scope, type) {
var request = $http({
method: "get",
url: url_svg
});
var svg = request.then( _handleSuccess, _handleFail );
svg.then(function(result){
$scope.resultSVG[type] = $sce.trustAsHtml(result);
});
};
function _handleFail(response) {
verifyFail(response);
loadingOff('');
}
function _handleSuccess(response) {
if($http.pendingRequests.length === 0){
loadingOff('');
}
return response.data;
}
What is to read from the avatar ... would be these pending ...