When making a request to an API using $http in AngularJS, I am receiving cached results. Below is the AngularJS code snippet:
$scope.validate = function(){
var encodedUserNameAndPassword = Base64.encode($scope.username + ':' + $scope.password);
var decode = Base64.decode(encodedUserNameAndPassword);
$http.defaults.headers.put = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers': '*'
};
$http.defaults.headers.common['Authorization'] = 'Basic ' + encodedUserNameAndPassword;
$http({method: 'GET', url: 'http://127.0.0.1:5000/user/jim',cache:false}).
success(function(data, status, headers, config) {
console.log(data);
}).
error(function(data, status, headers, config) {
alert(data);
});
}
I am unsure of what I might be overlooking. Any assistance would be greatly appreciated.