javascript - Properly loading controller path in ui-router -


i'm working on complex angular app , i'd know if there proper way load controller file path in ui-router.

currently, load every controllers file in main view : <script src="myctrl.js"></script>.

i know can use ui-router :

 $state provider     .state('state1'), {        url: '/state1',        views : {            'area1' : {                         templateurl: 'myview.html',                         controller: 'myctrlname' // change load file ?             },             ... // other area + templateurl here        }     } 

but it's used load controller name, not path. tried find way using load or file functions instead, didn't make it.

do have idea ?

edit : maybe can know thatmy goal load controller file out of html view in order simplify html file , add/delete controllers in app.

according radim köhler , these questions angular-ui-router requirejs, lazy loading of controller + angularamd + ui-router + dynamic controller name?, i'll try use requirejs.

thanks lot guys :)


Comments