feat(TemplateConfig): support array of arrays in TemplateConfig directives

Fixes #592
Closes #600
This commit is contained in:
Marc Laval
2015-02-11 01:03:11 +01:00
parent 8844671c8d
commit 6d8ccaa8e4
3 changed files with 30 additions and 4 deletions

View File

@ -30,6 +30,21 @@ export class DirectiveMetadataReader {
componentDirectivesMetadata(annotation:Component):List<Type> {
var template = annotation.template;
return isPresent(template) && isPresent(template.directives) ? template.directives : [];
var result:List<Type> = ListWrapper.create();
if (isPresent(template) && isPresent(template.directives)) {
this._buildList(result, template.directives);
}
return result;
}
_buildList(out:List<Type>, tree:List<any>) {
for (var i = 0; i < tree.length; i++) {
var item = tree[i];
if (ListWrapper.isList(item)) {
this._buildList(out, item);
} else {
ListWrapper.push(out, item);
}
}
}
}