Hello
It is possible to load two controllers on the home page ?
I would like to load a controller for the view and one for the index
Here is my code:
`
// application-configuration.js
"use strict";
define(['angularAMD', 'angular-route', 'ui-bootstrap', 'angular-sanitize', ],
function (angularAMD) {
var app = angular.module("mainModule", ['ngRoute', 'ngSanitize', 'ui.bootstrap']);
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when("/", angularAMD.route({
templateUrl: function (rp) {
return 'views/home.html';
},
controllerUrl: "../boffice/angular/controllers/controller.home"
}))
.when("/:page", angularAMD.route({
templateUrl: function (rp) {
return 'views/' + rp.page + '.html'; },
resolve: {
load: ['$q', '$rootScope', '$location',
function ($q, $rootScope, $location) {
var path = $location.path();
var parsePath = path.split("/");
//var parentPath = parsePath[1];
var controllerName = parsePath[1];
//console.log('controllerName', controllerName);
var loadController = "../boffice/angular/controllers/controller." + controllerName;
var deferred = $q.defer();
require([loadController], function () {
$rootScope.$apply(function () {
deferred.resolve();
});
});
return deferred.promise;
}]
}
}))
.when("/:section/:tree/:id", angularAMD.route({
templateUrl: function (rp) {
return 'views/' + rp.section + '/' + rp.tree + '.html'; },
resolve: {
load: ['$q', '$rootScope', '$location',
function ($q, $rootScope, $location) {
var path = $location.path();
var parsePath = path.split("/");
var parentPath = parsePath[1];
var controllerName = parsePath[2];
var loadController = "Views/" + parentPath + "/" +
controllerName + "Controller";
var deferred = $q.defer();
require([loadController], function () {
$rootScope.$apply(function () {
deferred.resolve();
});
});
return deferred.promise;
}]
}
}))
.otherwise({ redirectTo: '/' })
}]);
// Bootstrap Angular when DOM is ready
angularAMD.bootstrap(app);
return app;
});
Hello It is possible to load two controllers on the home page ? I would like to load a controller for the view and one for the index Here is my code: ` // application-configuration.js
"use strict"; define(['angularAMD', 'angular-route', 'ui-bootstrap', 'angular-sanitize', ], function (angularAMD) {
`