I am very new to angular and JS and do not know how to implement very simple behavior. So... I have an angular-route module and all my views are changed with ng-view directive. Here is the declaration
<body>
<div class="row main" ng-view> </div>
<body>
I have all controllers connected to those views. Also I have one common controller to all views, I check cookie in that controller. How to call that controller automatically in all other views without dependency on that controller from others?
I tried to put it in but it is called only once on the index page.
You can do something like this:
<body>
<div ng-controller="globalController">
<div class="row main" ng-view> </div>
</div>
<body>
A controller, by definition, is meant to prepare the data to be passed to the view.
I would recommend you to do this with a service instead.
This service could then be accessed by whatever view you are in.
You could imagine, for example, to implement a resolver in you $routeProvider.when which will read the Cookie from this service. $route also trigger events whenever the view is changing, will change or has changed. Try to leverage this, this is really powerful.