[Framework] Custom route registration
Add custom extension registration code for routes, using these to configure Angular's routeProvider. WTD-518.
This commit is contained in:
@@ -46,6 +46,9 @@ define(
|
|||||||
definition[k] = bundleDefinition[k];
|
definition[k] = bundleDefinition[k];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Record path to bundle in definition
|
||||||
|
definition.path = path;
|
||||||
|
|
||||||
// Build up the log-friendly name for this bundle
|
// Build up the log-friendly name for this bundle
|
||||||
if (definition.key || definition.name) {
|
if (definition.key || definition.name) {
|
||||||
logName += "(";
|
logName += "(";
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
* Module defining CustomRegistrars. Created by vwoeltje on 11/3/14.
|
* Module defining CustomRegistrars. Created by vwoeltje on 11/3/14.
|
||||||
*/
|
*/
|
||||||
define(
|
define(
|
||||||
[],
|
['./Constants'],
|
||||||
function () {
|
function (Constants) {
|
||||||
"use strict";
|
"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 {
|
return {
|
||||||
services: registerExtension;
|
routes: registerRoute
|
||||||
|
services: new CustomRegistrar("service")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user