feat(ivy): support host attribute and property bindings (#22334)

PR Close #22334
This commit is contained in:
Chuck Jazdzewski
2018-02-15 16:43:16 -08:00
committed by Kara Erickson
parent c499c8f4db
commit 73c203fda9
8 changed files with 201 additions and 62 deletions

View File

@ -63,9 +63,8 @@ export class BindingParser {
getUsedPipes(): CompilePipeSummary[] { return Array.from(this._usedPipes.values()); }
createDirectiveHostPropertyAsts(
dirMeta: CompileDirectiveSummary, elementSelector: string,
sourceSpan: ParseSourceSpan): BoundElementPropertyAst[]|null {
createBoundHostProperties(dirMeta: CompileDirectiveSummary, sourceSpan: ParseSourceSpan):
BoundProperty[]|null {
if (dirMeta.hostProperties) {
const boundProps: BoundProperty[] = [];
Object.keys(dirMeta.hostProperties).forEach(propName => {
@ -78,11 +77,19 @@ export class BindingParser {
sourceSpan);
}
});
return boundProps.map((prop) => this.createElementPropertyAst(elementSelector, prop));
return boundProps;
}
return null;
}
createDirectiveHostPropertyAsts(
dirMeta: CompileDirectiveSummary, elementSelector: string,
sourceSpan: ParseSourceSpan): BoundElementPropertyAst[]|null {
const boundProps = this.createBoundHostProperties(dirMeta, sourceSpan);
return boundProps &&
boundProps.map((prop) => this.createElementPropertyAst(elementSelector, prop));
}
createDirectiveHostEventAsts(dirMeta: CompileDirectiveSummary, sourceSpan: ParseSourceSpan):
BoundEventAst[]|null {
if (dirMeta.hostListeners) {