I'm working on a complex Angular app and I'd like to know if there is a proper way to load a controller file path in an ui-router.
Currently, I load every controllers file in the main view like this : <script src="myCtrl.js"></script>
.
I know that I can use ui-router like this :
$state provider
.state('state1'), {
url: '/state1',
views : {
'area1' : {
templateUrl: 'myView.html',
controller: 'myCtrlName' // change this to load the file ?
},
... // some other area + templateUrl here
}
}
But it's used to load the controller name, not its path. I tried to find a way by using load
or file
functions instead, but it didn't make it.
Do you have any idea ?
Edit : Maybe it can help you to know thatmy goal is to load my controller file out of the html view in order to simplify the html file and simply add/delete controllers in the app.