I have a page in that header and footer part is the common and view part is different.
The code I written for the index.html
page is:
<html lang="en" data-ng-app="dashboard">
<head>
<!-- All the Libraries & css-->
</head>
<body>
<header> </header>
<data-ng-view> </data-ng-view>
<footer> </footer>
</body>
</html>
For data-ng-view
, in the homepage I have 3 divs
each div have it's own controller.
Main controller is like:
var app = angular.module('dashboard', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/records',
{
templateUrl: 'view/homepage.html',
controller: 'RecordsController'
}
). otherwise({redirectTo: '/records'});
}]);
Here is the structure for the homepage.html
<div id='main'>
<article>
<div ng-controller="FlipDemoCtrl">
<!-- contents to display -->
</div>
</article>
<nav>
<div ng-controller="HomePageLinks">
<!-- contents to display -->
</div>
<hr>
<ul ng-controller="ResolveProblem">
<!-- list of contents through ng-repeat -->
</ul>
<hr>
</nav>
</div>
My question is:
How should I define the RecordsController
so that through this controller I am able to call the FlipDemoCtrl
, ResolveProblem
& HomePageLinks
Controller.
function RecordsController($scope, $http) {
// How should I write this function to call the multiple controllers
}