Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Confused on how to render the views.

From what I understood, when you send a request to the server, it sends you back the entire application, Angular then, takes care of rendering those templates or views. But what happens if I need to use server side logic on my templates, like if I have a protected page for example ? I can't let the server send that back until I know that the user has logged in. I can't use server side logic on Angular can I ? Like, for example, access variables declared on my express server on my angular controller. Is it possible ?

1 Answer

Spencer Snyder
Spencer Snyder
4,030 Points

Yes totally possible and common. Use the library to look up JavaScript and then view the vid "authentication with express and mongo" for a full tutorial. Idk much about angular but all the user stuff would be handled on the backend anyway with express routes.