yalabot / angular-foundation

http://pineconellc.github.io/angular-foundation/
Other
1.05k stars 267 forks source link

How to load controller file of modal directive dynamically #202

Closed yonus closed 9 years ago

yonus commented 9 years ago

In web application there are a lot of modal template (angular foundation modal). When the modal is opened, we must give controller . because of a lot of modals , we writing controllers of modal in js file. if controller js of each modal is loaded seperately as js file ,this is not efficient for me. so , I want to load controller of the modal , when the modal is opened. It is like :

var modalInstance = $modal.open({ templateUrl: 'myModalContent.html', controller: 'modal-controller.js' }) can it be done? if so, how can I do that this,

thank your helps

jbrowning commented 9 years ago

The modal directive is not concerned with the loading of JS files. That should be handled by whatever method you use to compile and concatenate your app's JS files. The controller that you specify in the controller parameter is Angular's name for the controller, not the filename of the controller.