I have my front part of the application in AngularJs with JSP files.
The index.jsp use the directive ng-view to show the views :
index.jsp
<div ng-view autoscroll="true" style="overflow: auto;"></div>
and the app.js to link with $routeProvider the controller to the view (home.jsp do some includes of views.jsp) :
app.js
$routeProvider
.when('/Error', {
controller: 'LoginController',
templateUrl: 'modules/authentication/views/errorConnexion.jsp',
hideMenus: true
})
.when('/', {
controller: 'HomeController',
templateUrl: 'modules/home/views/home.jsp'
})
.otherwise({ redirectTo: '/login' });
and my HomeController uses fields to hide or show some DOM elements :
HomeController.js
app.controller('HomeController',
['$timeout',
'service',
'$scope',
'$rootScope',
'$filter',
'$location',
'$window',
'ModalService',
'ngTableParams',
'$http',
'$interval',
'Excel',
function($timeout, service, $scope,
$rootScope, $filter, $location, $window,
ModalService, ngTableParams, $http, $interval, Excel) {
$scope.Hide_Module = true;
})]);
My controller child :
ChildController.js
app
.controller('ChildController',
function() {
$scope.field = "random";
}
);
And finally the problem, the view :
view.jsp
<section ng-controller="ChildController" class="content"
ng-hide="Hide_Module">
The problem is : If I remove ng-controller directive on the section tag, all is alright. But if I add it, the main view (index.jsp) shows view.jsp......
So I want to know what I did wrong and moreover how angularjs deals with controllers inheritance and how they are binded through the views ?