[Example] Use non-built-in extensions

Use non-built-in extensions in an example bundle,
WTD-518.
This commit is contained in:
Victor Woeltjen
2014-11-05 12:40:53 -08:00
parent 22034d3305
commit ff9682c40c
2 changed files with 19 additions and 3 deletions

View File

@ -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."
}
] ]
} }
} }

View File

@ -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
}; };
} }