--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+.controller('ProjectsCtrl', function ($scope, $rootScope, $location, $http) {
+
+ $scope.projects = [];
+ $http.get('/api/projects').success(function(projects) {
+ $scope.projects = projects;
+ $scope.cfProjects = [];
+ $scope.csProjects = [];
+ for (var i in $scope.projects) {
+ if ($scope.projects[i].state === "En financement") {
+ $scope.cfProjects.push($scope.projects[i]);
+ }
+
+ if ($scope.projects[i].state === "En développement") {
+ $scope.csProjects.push($scope.projects[i]);
+ }
+ }
+ });
+
+
+ $scope.convertToLocaleDate = function(date) {
+ return new Date(date).toLocaleDateString();
+ }
+
+ /**
+ *
+ * @function goto
+ * @parameters String route, String projectId
+ * @description Going to route and adding projectId to rootScope
+ *
+ **/
+ $scope.goto = function(route, projectId) {
+ $rootScope.project_id = projectId;
+ $location.path(route);
+
+ }
+
+ /**
+ *
+ * @function goto2
+ * @parameters String route, String profileId
+ * @description Going to route and adding profileId to rootScope
+ *
+ **/
+ $scope.goto2 = function(route, profileId) {
+ $rootScope.profile_id = profileId;
+ $location.path(route);
+ }
+});