diff --git a/platform/framework/src/Bundle.js b/platform/framework/src/Bundle.js index 8af337521a..fe38c5dc8e 100644 --- a/platform/framework/src/Bundle.js +++ b/platform/framework/src/Bundle.js @@ -46,6 +46,9 @@ define( definition[k] = bundleDefinition[k]; }); + // Record path to bundle in definition + definition.path = path; + // Build up the log-friendly name for this bundle if (definition.key || definition.name) { logName += "("; diff --git a/platform/framework/src/CustomRegistrars.js b/platform/framework/src/CustomRegistrars.js index e618de795b..611d9d8cc9 100644 --- a/platform/framework/src/CustomRegistrars.js +++ b/platform/framework/src/CustomRegistrars.js @@ -4,8 +4,8 @@ * Module defining CustomRegistrars. Created by vwoeltje on 11/3/14. */ define( - [], - function () { + ['./Constants'], + function (Constants) { "use strict"; /** @@ -44,8 +44,31 @@ define( } } + function registerRoute(extension, index) { + var route = Object.create(extension); + + // Adjust path for bundle + if (route.templateUrl) { + route.templateUrl = [ + route.bundle.path, + route.bundle.resources, + route.templateUrl + ].join(Constants.SEPARATOR); + } + + // Register the route with Angular + app.config(['$routeProvider', function ($routeProvider) { + if (route.when) { + $routeProvider.when(route.when, route); + } else { + $routeProvider.otherwise(route); + } + }]); + } + return { - services: registerExtension; + routes: registerRoute + services: new CustomRegistrar("service") }; }