fix(compiler): support dotted property binding
fixes angular/flex-layout#34
This commit is contained in:
parent
95f48292b1
commit
3bee521aa4
|
@ -245,18 +245,12 @@ export class BindingParser {
|
|||
|
||||
let unit: string = null;
|
||||
let bindingType: PropertyBindingType;
|
||||
let boundPropertyName: string;
|
||||
let boundPropertyName: string = null;
|
||||
const parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
|
||||
let securityContexts: SecurityContext[];
|
||||
|
||||
if (parts.length === 1) {
|
||||
const partValue = parts[0];
|
||||
boundPropertyName = this._schemaRegistry.getMappedPropName(partValue);
|
||||
securityContexts = calcPossibleSecurityContexts(
|
||||
this._schemaRegistry, elementSelector, boundPropertyName, false);
|
||||
bindingType = PropertyBindingType.Property;
|
||||
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
|
||||
} else {
|
||||
// Check check for special cases (prefix style, attr, class)
|
||||
if (parts.length > 1) {
|
||||
if (parts[0] == ATTRIBUTE_PREFIX) {
|
||||
boundPropertyName = parts[1];
|
||||
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
|
||||
|
@ -280,12 +274,18 @@ export class BindingParser {
|
|||
boundPropertyName = parts[1];
|
||||
bindingType = PropertyBindingType.Style;
|
||||
securityContexts = [SecurityContext.STYLE];
|
||||
} else {
|
||||
this._reportError(`Invalid property name '${boundProp.name}'`, boundProp.sourceSpan);
|
||||
bindingType = null;
|
||||
securityContexts = [];
|
||||
}
|
||||
}
|
||||
|
||||
// If not a special case, use the full property name
|
||||
if (boundPropertyName === null) {
|
||||
boundPropertyName = this._schemaRegistry.getMappedPropName(boundProp.name);
|
||||
securityContexts = calcPossibleSecurityContexts(
|
||||
this._schemaRegistry, elementSelector, boundPropertyName, false);
|
||||
bindingType = PropertyBindingType.Property;
|
||||
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
|
||||
}
|
||||
|
||||
return new BoundElementPropertyAst(
|
||||
boundPropertyName, bindingType, securityContexts.length === 1 ? securityContexts[0] : null,
|
||||
securityContexts.length > 1, boundProp.expression, unit, boundProp.sourceSpan);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue