I have created this Plunker . As can you see this not work. If change the example likes bellow works fine!
.state('home', {
url: '/home',
templateUrl: 'controllerView.html',
controller: 'Controller',
});
<head>
<script type="text/javascript" src="https://code.angularjs.org/1.2.13/angular.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.8/angular-ui-router.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/oclazyload/1.0.9/modules/ocLazyLoad.core.min.js"></script>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript" src="controller.js"></script>
The problem is that i want to load controller.js file when user is a specific controller's state and not when is in other state in app. In this example i try to do this, but it doesn't works!