Users Search and NavBar Partials
Fullstack Social iOS NodeJS REST
We are now ready to move onto the phase of our web application which is to build out a user searching page. Before I show you how to list our users, let's first create a navigation system for our site. The navigation will simply include a navigation bar at the top containing a few anchor tags. In order to share this code across pages, we'll place this in a partial and import it using Sails partial feature. Enjoy.

Comments (5)
Tom Andrew
4 years ago
Hey Brian. When I add the custom nav layout to the res.view controller, it messes up all of the CSS I had been perfecting. Is this because it removes the "reset CSS" file built into Sails perhaps? Has anyone else noticed this and figured out a work around? res.view('pages/post/home', { allPosts, layout: 'layouts/nav-layout' })
Brian Voong
4 years ago
sereisoglu
3 years ago
Hey Brian. Why did you use partial for navbar? Why didn't you write navbar codes in nav-layout.ejs?
gerkov77
3 years ago
It makes sense to do it in the 'nav-layout.ejs', absolutely! I think Brian wanted to teach us the concept of partials –, writing smaller chunks of reusable UI code. Also partials do not determine the layout of the whole page, they are just reusable visual elements, which can be easily added this way, wherever they're needed. What I would try is to call those partials only in certain layout files.
skulsky
3 years ago
Hi Brian -- I'm running into a problem where the home.ejs file is no longer updating, with or without the partial included in the file. Any idea why this may be?
Brian Voong
3 years ago
skulsky
3 years ago
I feel pretty dumb -- I have a missed place tag -- yikes. Thanks for the quick reply though
alejandro
3 years ago
Hey brian i got this: Somehow, the user record for the logged-in user (`5e667b32b2ccbf0461c3b211`) has gone missing.... and it deleted all of the users
vishallakshmi
3 years ago
I have the same issue. Did you find out why this happening?
omq78
3 years ago
hi guys anyone have this bothering warning on console ? (node:50011) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated thanks
HELP & SUPPORT