-
Notifications
You must be signed in to change notification settings - Fork 25.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): add ability to reflect DOM properties as attributes #3072
Conversation
@@ -186,6 +193,11 @@ export class DomRenderer extends Renderer { | |||
setElementProperty(location: RenderElementRef, propertyName: string, propertyValue: any): void { | |||
var view = resolveInternalDomView(location.renderView); | |||
view.setElementProperty(location.boundElementIndex, propertyName, propertyValue); | |||
// Reflect the property value as an attribute value with ng-reflect- prefix. | |||
if (this._reflectPropertiesAsAttributes) { | |||
this.setElementAttribute(location, REFLECT_PREFIX + camelCaseToDashCase(propertyName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use string interpolation
bb708d5
to
27ad9f5
Compare
@tbosch I made the change to use string interpolation and to unwrap the prefix string literal from CONST_EXPR. Look good? |
Reviewed with @tbosch in person and got the LGTM when green. |
By binding the token `DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES` provided by the dom_renderer module to `true` in the root injector (i.e. bootstrap()), all elements whose properties are set by angular will be reflected as attributes with the prefix "ng-reflect-". Fixes angular#2910
27ad9f5
to
903ff90
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
By binding the token
DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES
provided bythe dom_renderer module to
true
in the root injector (i.e. bootstrap()),all elements whose properties are set by angular will be reflected as
attributes with the prefix "ng-reflect-".
Fixes #2910
NOTE: I expect enforce-format to break since it is broken on master right now. @alexeagle is fixing.