Skip to content

Conversation

jeffbcross
Copy link
Contributor

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 #2910

NOTE: I expect enforce-format to break since it is broken on master right now. @alexeagle is fixing.

@jeffbcross jeffbcross added feature Issue that requests a new feature comp: core action: review The PR is still awaiting reviews from at least one requested reviewer labels Jul 15, 2015
@jeffbcross jeffbcross added this to the alpha-32 milestone Jul 15, 2015
@@ -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),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use string interpolation

@jeffbcross
Copy link
Contributor Author

@tbosch I made the change to use string interpolation and to unwrap the prefix string literal from CONST_EXPR. Look good?

@jeffbcross
Copy link
Contributor Author

Reviewed with @tbosch in person and got the LGTM when green.

@jeffbcross jeffbcross assigned jeffbcross and unassigned tbosch Jul 15, 2015
@jeffbcross jeffbcross added pr_state: LGTM action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jul 15, 2015
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
@jeffbcross jeffbcross merged commit 903ff90 into angular:master Jul 15, 2015
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes feature Issue that requests a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mirror dom property values as attribute values in debug mode
3 participants