Angular allows you to load templates by router means dynamically, but so far I have not found a single example where the controller would dynamically load also ...
var app = angular.module( 'app', ['ngRoute'] ); app.config([ '$routeProvider', function( $routeProvider ) { $routeProvider .when('/', { templateUrl: 'template/main/main.html', controller: 'MainCtr' }) .when('/login', { templateUrl: 'template/only/login.html', controller: 'LoginCtr' }) .otherwise({ redirectTo: '/' }); } ]); How to load controllers dynamically with loading a template? For example, if the controller script is in the same folder with the template. Or is the 'standard' router not suitable for these purposes?
