mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 06:08:11 +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": [
|
||||
{
|
||||
"key": "exampleDirective",
|
||||
"implementation": "ExampleDirective.js"
|
||||
"implementation": "ExampleDirective.js",
|
||||
"depends": [ "examples[]" ]
|
||||
}
|
||||
],
|
||||
"routes": [
|
||||
@ -26,6 +27,11 @@
|
||||
"key": "exampleService",
|
||||
"implementation": "ExampleService.js"
|
||||
}
|
||||
],
|
||||
"examples": [
|
||||
{
|
||||
"text": "This is an example from example/builtins."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -12,9 +12,19 @@ define(
|
||||
*
|
||||
* @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 {
|
||||
template: "And this came from a directive."
|
||||
template: template
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user