Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: how to retrieve data faster from angularJS get call

Kumar:

I'm calling angularJS get call and parse the response and showing the response in UI, but I see a slight delay on the UI, is there a way that I can fix this:

Here is what my code is :


controller.js:


function controller($scope, empDetails) {
var empName;
empDetails.getEmpDetails().then(function successCallback(response) {
empName= response.data.name;
if (empName) {
$scope.name= empName;
}
});

angular.module('abc')
.controller('controller', controller);
})();

service.js:

(function () {
"use strict";
var empDetails= function ($http) {
var factory = {};
factory.getEmpDetails = function () {
return $http({
method: 'GET',
url: '/someurl'
}).then(function (data) {
return data;
})
}
return factory;
};
empDetails.inject = ['$http'];
angular.module('abc').service('empDetails', empDetails);
}())

thanks



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: how to retrieve data faster from angularJS get call

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×