I'm struggling to grasp how Angular handles routing in my single-page application.
Here's my issue: When I type in the url:
localhost:3000/streams/
I expect the 'streams' page to load. My understanding was this:
My express server gets the request and responds with a layout.
app.get('/streams/',function(req,res){ res.render('layout'); })
- The layout page is rendered, it includes a client app.js with ng-view.
Angular should intercept the '/streams/' path and request the 'streams' template. Like so:
$routeProvider .when('/', { templateUrl: '/templates/mainpage' } ) .when('/streams/', { templateUrl: '/templates/streams' } )
In reality, things are way off.
When I enter '/streams'
, Angular fetches /templates/streams
, and
when I enter '/streams/
, Angular fetches /templates/mainpage
.
Why is this happening?
This confusion has been bothering me for days...
Any assistance will be appreciated with 5 units of positive energy.
Thank you.