I have a single page application, which has a root module with about 5 seperate smaller modules.
var rootModule = angular.module('root', ["firstModule", "secondModule", "thirdModule"])
Each module has directives and controllers. Today I discovered that I can access other module and controller scope from all other modules and controllers.
So for example this controller:
thirdModule.controller('ThirdController', ['$scope', function ($scope) {
alert($scope.title);
}
And in this controller I alert the variable and it works.
firstModule.controller('FirstController', ['$scope', function ($scope) {
$scope.title = "Hello"
}
So basically I initiate my application with ng-app="root"
. Is this normal that everything has shared scope, or I have something wrong with my setup?
I thought modules give me code seperation and controllers are singletons with new scope.