diff --git a/README.md b/README.md index 43b6884..27a6bc5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,39 @@ angularjs-requirejs-lazy-controllers ==================================== -Modified AngularJS' ngView and ngController directives to enable support for lazy loading of controllers using RequireJS. \ No newline at end of file +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 + +```javascript + + return angular.module('myApp', [], function ($compileProvider, $controllerProvider) { + routeConfig.setCompileProvider($compileProvider); + routeConfig.setControllerProvider($controllerProvider); + }) +``` + +### routes.js + +```javascript + + 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 \ No newline at end of file diff --git a/app/css/app.css b/app/css/app.css index 4aeb659..afce8ab 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -1,2 +1,6 @@ /* app css stylesheet */ +body { + padding-left: 20px; + padding-top: 20px; +} diff --git a/app/index.html b/app/index.html index 3140f9c..c423a55 100644 --- a/app/index.html +++ b/app/index.html @@ -13,12 +13,8 @@ view2 -
+ -