I think I have a fundamental misunderstanding about the way angular intercepts my routes in a single-page application.
My problem, I think, is pretty simple. When I enter the url:
localhost:3000/streams/
I would like to load the 'streams' page. The way I thought it works is as follows:
My express server receives the request, and answers with a layout.
app.get('/streams/',function(req,res){ res.render('layout'); })
- My layout page is rendered. It calls a client app.js and has ng-view.
Angular intercepts the '/streams/' path, and then makes a call for the 'streams' template. Like this:
$routeProvider .when('/', { templateUrl: '/templates/mainpage' } ) .when('/streams/', { templateUrl: '/templates/streams' } )
For some reason, reality is very very different.
When I load '/streams'
, angular retrieves /templates/streams
, and
when I load '/streams/
, angular retrieves /templates/mainpage
.
Why?
This misunderstanding has been trolling me for days now...
Any help will be rewarded with 5 quanta of good energy.
Thanks.