Skip to content

Instantly share code, notes, and snippets.

@dovy
Last active January 2, 2016 18:29
Show Gist options
  • Save dovy/8344098 to your computer and use it in GitHub Desktop.
Save dovy/8344098 to your computer and use it in GitHub Desktop.
'use strict';
angular.module('rootSnapApp')
.constant('ListCtrlResolver', {
ancestry: function(familysearch) {
return familysearch.getCurrentUserPersonId().then(function(id) {
return familysearch.getAncestry(id, {personDetails: true}).then(function(response) {
return response.getPersons();
});
});
}
})
.controller('ListCtrl', function ($scope, $location, ancestry) {
console.log(ancestry);
$scope.ancestry = ancestry;
$scope.getAncestryHtml = function(n) {
var result = '';
n = parseInt(n);
console.log(n);
while (n > 1) {
result = ((n % 1) ? '<span class="female"></span>' : '<span class="male"></span>' ) + result;
n = n>>1;
}
if (result !== '') {
result = '<div class="dots">'+result+'</div>';
}
return result;
};
$scope.select = function(person) {
$location.path('/profile').search({id: person.id});
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment