I lazy-loaded a directive but nothing changed on my page

If the directive was in your DOM before you lazy-loaded its definition, you need to tell Angular that it should parse the DOM to recompile the new directive. To do that you need to use $compile :

$ocLazyLoad.load('gridModule').then(function() {

You could also use the ocLazyLoad directive, it was mainly written just for this case.

Is it possible to unload a resource ?

There is no way to unload javascript, but you can remove css by deleting the link tag of your resource with something like that:


Do you have a plunkr I could use to open an issue ?

Yes, You can fork this one: http://plnkr.co/edit/n4DG0bbC14Mm1uccBptd?p=preview

How can I use a service that I just lazy loaded ?

You have to use $injector:

var app = angular.module("myApp", ["oc.lazyLoad"]);

app.controller('MyCtrl', function($scope, $ocLazyLoad, $injector) {
    $ocLazyLoad.load('ngDialog.js').then(function() {
        var ngDialog = $injector.get('ngDialog');
            template: 'dialogTemplate'

Can I lazy-load all AngularJS modules?

No. While you can load almost any module it is not possible to load some 'native' modules because they are to tightly integrated into AngularJS. An incomplete list of modules not lazy-loadable: ngAnimate, ngRoute, ngSanitizer, ngTouch.
(If you stumble across a further module please drop an edit suggestion).