Skip to content

Commit

Permalink
Merged hotfix/MyProjectsSearchBug into master
Browse files Browse the repository at this point in the history
  • Loading branch information
hmaciasc committed Nov 30, 2016
2 parents 6dcc844 + 886f205 commit f9a348a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/scripts/controllers/projects/myProjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

angular.module('crowDevelop')

.controller('MyProjectsCtrl', ['$rootScope', '$scope', '$firebaseArray', function($rootScope, $scope, $firebaseArray) {
.controller('MyProjectsCtrl', ['$rootScope', '$scope', '$firebaseArray', 'ProjectService', function($rootScope, $scope, $firebaseArray, ProjectService) {

$scope.getOwnProjects = function() {
var projectsRef = firebase.database().ref('projects/');
Expand All @@ -16,5 +16,17 @@ angular.module('crowDevelop')
}
};

$scope.findProject = function() {
$rootScope.projectSearch = ProjectService.findProjects('name', $scope.query);
if (!$rootScope.projectSearch.length) addEmptyMessage();
};


function addEmptyMessage() {
$scope.errorMessage = {};
$scope.errorMessage.big = 'No projects found with that name';
$scope.errorMessage.small = 'Look for something else';
}

$scope.getOwnProjects();
}]);

0 comments on commit f9a348a

Please sign in to comment.