Google Groups

Re: Lazyload external JS/CSS files based on controller namespace convention?

Eric Jain Apr 5, 2012 12:54 PM
Posted in group: Angular and AngularJS discussion

On Apr 5, 10:35 am, ItsLeeOwen <>
> Does angularJS have anything in place to lazyload external JS/CSS files
> based on ng-controller namespaces? So that the following would append
> com.myApp.SomeClass.js and com.myApp.SomeClass.css to the document head?
> <div ng-controller="com.myApp.SomeClass"></div>

This only makes sense if the div with the ng-controller is also lazy-
loaded, right?

I thought it would be possible to do that with ng-switch, though it
doesn't quite work in this example: