app.controller('ArticleDetails', ['$scope', '$routeParams', 'articles.repository', function($scope, $routeParams, articlesRepository) { var articleId = $routeParams.id, articleModel = {}; articlesRepository.getArticleById(articleId).then(function(response) { $scope.article = response.data; $scope.article.date = new Date($scope.article.date); }, function(error) {}); }]);