mirror of
https://github.com/nasa/openmct.git
synced 2025-04-13 06:03:06 +00:00
[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:
parent
306d8ae9db
commit
9541d6716a
@ -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 += "(";
|
||||
|
@ -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")
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user