Need help with angularjs-requirejs-lazy-controllers?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

matys84pl
206 Stars 60 Forks 6 Commits 8 Opened issues

Description

Routes configuration that loads template, controller and directives using RequireJS. Files are loaded (in parallel) when user changes the location and are displayed in Angular's ngView.

Services available

!
?

Need anything else?

Contributors list

# 302,305
JavaScr...
Shell
Ruby
5 commits

angularjs-requirejs-lazy-controllers

Routes configuration that loads template, controller and directives using RequireJS. Files are loaded (in parallel) when user changes the location and are displayed in Angular's ngView.

Used libs

  1. Angular 1.0.2
  2. RequireJS 2.1.1
  3. RequireJS text 2.0.3

Usage

app.js

 return angular.module('myApp', [], function ($compileProvider, $controllerProvider) {
         routeConfig.setCompileProvider($compileProvider);
         routeConfig.setControllerProvider($controllerProvider);
     })

routes.js

 return app.config(function ($routeProvider) {
        $routeProvider.when('/view1', routeConfig.config('../partials/view1.html', 'controllers/first'));
        $routeProvider.when('/view2', routeConfig.config('../partials/view2.html', 'controllers/second', ['directives/version']));

    $routeProvider.otherwise({redirectTo:'/view1'});
});

License

MIT

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.