marcoslin / angularAMD

Facilitate use of RequireJS in AngularJS
http://marcoslin.github.io/angularAMD
MIT License
734 stars 171 forks source link

ng-Controllers on index.html site #16

Closed dmoshfegh closed 10 years ago

dmoshfegh commented 10 years ago

Is there a way to use ng-controllers on the main site outside of the ng-view? Why: We want to display a dynamic navigation. Therefore we need a ng-controller on our index.html Atm. we resolved this issue with ng-include on the subsites and put the ng-view on the body...

marcoslin commented 10 years ago

This can be done easily in the app.js. Check out this plunker: http://plnkr.co/edit/azsKJnFJ0pYwBW0dGMFH?p=preview

Long answer: As angularAMD depends on the resolve property of $routeProvider to provide on-demand loading of JS, you cannot configure the ng-controller to be used in your index.html in a RequireJS module. You need to define this controller using regular AngularJS syntax. The easiest way is to define it your app.js but you can also define it as a normal AngularJS module and then inject the dependency into your app.

If you like angularAMD, please consider to Star this project.

priyank2005 commented 9 years ago

How to load service using ngload in this?

kudeshiyah commented 7 years ago

hello there, link you provided (http://plnkr.co/edit/azsKJnFJ0pYwBW0dGMFH?p=preview) is not working. plz check