feat(compiler): allow setting attributes on a host element

Closes #1402
This commit is contained in:
Pawel Kozlowski
2015-05-01 13:41:56 +02:00
parent 7225416661
commit 51839ca677
12 changed files with 107 additions and 1 deletions

View File

@ -78,6 +78,13 @@ export class DirectiveParser extends CompileStep {
this._bindHostProperty(hostPropertyName, directivePropertyName, current, directiveBinderBuilder);
});
}
if (isPresent(directive.hostAttributes)) {
MapWrapper.forEach(directive.hostAttributes, (hostAttrValue, hostAttrName) => {
if (!DOM.hasAttribute(current.element, hostAttrName)) {
DOM.setAttribute(current.element, hostAttrName, hostAttrValue);
}
});
}
if (isPresent(directive.readAttributes)) {
ListWrapper.forEach(directive.readAttributes, (attrName) => {
elementBinder.readAttribute(attrName);