mirror of
https://github.com/nasa/openmct.git
synced 2025-06-15 13:48:12 +00:00
[Example] Use non-built-in extensions
Use non-built-in extensions in an example bundle, WTD-518.
This commit is contained in:
@ -13,7 +13,8 @@
|
|||||||
"directives": [
|
"directives": [
|
||||||
{
|
{
|
||||||
"key": "exampleDirective",
|
"key": "exampleDirective",
|
||||||
"implementation": "ExampleDirective.js"
|
"implementation": "ExampleDirective.js",
|
||||||
|
"depends": [ "examples[]" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"routes": [
|
"routes": [
|
||||||
@ -26,6 +27,11 @@
|
|||||||
"key": "exampleService",
|
"key": "exampleService",
|
||||||
"implementation": "ExampleService.js"
|
"implementation": "ExampleService.js"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"examples": [
|
||||||
|
{
|
||||||
|
"text": "This is an example from example/builtins."
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,9 +12,19 @@ define(
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function ExampleDirective() {
|
function ExampleDirective(examples) {
|
||||||
|
// Build up a template from example extensions
|
||||||
|
var template = examples.length > 0 ?
|
||||||
|
"A directive loaded these example extensions:<ul>" :
|
||||||
|
"This came from a directive.<ul>";
|
||||||
|
|
||||||
|
examples.forEach(function (e) {
|
||||||
|
template += "<li>" + e.text + "</li>";
|
||||||
|
});
|
||||||
|
template += "</ul>";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
template: "And this came from a directive."
|
template: template
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user