feat(core): add ability to reflect DOM properties as attributes

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
This commit is contained in:
Jeff Cross
2015-07-15 10:55:44 -07:00
parent 66ec4d1f5c
commit 903ff9047f
5 changed files with 77 additions and 5 deletions

View File

@ -50,7 +50,11 @@ import {AppViewManagerUtils} from 'angular2/src/core/compiler/view_manager_utils
import {ELEMENT_PROBE_CONFIG} from 'angular2/debug';
import {ProtoViewFactory} from 'angular2/src/core/compiler/proto_view_factory';
import {RenderCompiler, Renderer} from 'angular2/src/render/api';
import {DomRenderer, DOCUMENT_TOKEN} from 'angular2/src/render/dom/dom_renderer';
import {
DomRenderer,
DOCUMENT_TOKEN,
DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES
} from 'angular2/src/render/dom/dom_renderer';
import {DefaultDomCompiler} from 'angular2/src/render/dom/compiler/compiler';
/**
@ -90,6 +94,7 @@ function _getAppBindings() {
.toFactory((doc) => new EmulatedUnscopedShadowDomStrategy(doc.head), [DOCUMENT_TOKEN]),
DomRenderer,
DefaultDomCompiler,
bind(DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES).toValue(false),
bind(Renderer).toAlias(DomRenderer),
bind(RenderCompiler).toAlias(DefaultDomCompiler),
ProtoViewFactory,