hari-p
2/7/2017 - 10:48 PM

Create caching of http request in angular for speedy load

Create caching of http request in angular for speedy load

'use strict';

/**
 * @ngdoc function
 * @name yeomanSassApp.controller:LinksCtrl
 * @description
 * # LinksCtrl
 * Controller of the yeomanSassApp
 */




var app = angular.module('yeomanSassApp');


app.controller('LinksCtrl',  ['$scope', '$http', 'ENV', 'HandleError', function($scope, $http, ENV, HandleError) {

       $scope.filters = { };
	   //Get Links Json
       $http.get(ENV.apiEndpoint + '/rest/usefulLink/', {
            cache: true,
            params: {
                     apiToken: ENV.apiToken
                    }
            }).success(function(data) {
               $scope.links =data.response.docs;
         }).error(function() {
                       new HandleError();
                   });

    }]);