Created
November 4, 2012 17:27
-
-
Save alanhoff/4012686 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Folio.find().distinct('category', function(err, categories) { | |
| var dadosCategoria = { }; | |
| var cat = []; | |
| var loop = categories.length | |
| categories.forEach(function(category){ | |
| Folio.count({'category' : category}, function(err, c) { | |
| dadosCategoria.name = category; | |
| dadosCategoria.count = c; | |
| cat.push(dadosCategoria); | |
| if(loop-- == 0) | |
| render(cat) | |
| }); | |
| }); | |
| console.log(cat); | |
| }); | |
| function render(categories){ | |
| res.render('portifolio', | |
| { | |
| categories:cat, | |
| title: 'Portifolio - Lucas Simon :: Portifolio' | |
| } | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment