I'm trying to create a view - I set up two controllers in practice, one HeaderCtrl, with some data in it (site name, title background, etc.), the other should have the main content of the page - MainCtrl.
When defining a route, I do this:
mainApp.config(function ($routeProvider) { $routeProvider .when('/', { controller: 'MainCtrl', templateUrl: 'modules/dashboard.html' }) })
This works fine, but I would like to specify a few parameters for this, for example:
mainApp.config(function ($routeProvider) { $routeProvider .when('/', { controller: 'HeaderCtrl', templateUrl: 'modules/header.html' }, { controller: 'MainCtrl', templateUrl: 'modules/dashboard.html' }) })
This does not work, so I assume that this is not a way to do this. What I'm actually asking is, can you specify multiple controllers in $ routeProvider? Or what would be the right way to build this view?
angularjs angularjs-routing
greedz Jun 27 '13 at 22:54 2013-06-27 22:54
source share