kanjiroushi.controller('PhotoOfDayController', function ($scope,$rootScope,$http,config,$routeParams,$q) { //config $scope.apiUrl = config.apiUrl; //view objects $scope.photo = {}; //Retrieving product console.log('retrieving photo of the day'); $scope.getPhotoOfTheDay = function() { $http({ url:config.apiUrl+'/photo/oftheday', method:"GET", }). success(function(data, status, headers, config) { $scope.photo = data.msg; console.log($scope.photo); }). error(function(data, status, headers, config) { console.log('error'); location.href = '#/404'; }); } $scope.getPhotoOfTheDay(); })