Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

refactor(NgElement): NgElement inject RootScope instead of Scope. #1452

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/core_dom/directive_injector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class DirectiveInjector implements DirectiveBinder {

NgElement get ngElement {
if (_ngElement == null) {
_ngElement = new NgElement(_node, scope, _animate, _destLightDom);
_ngElement = new NgElement(_node, _appInjector.getByKey(ROOT_SCOPE_KEY), _animate, _destLightDom);
}
return _ngElement;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/core_dom/ng_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class NgElement {
static const _TO_BE_REMOVED = const Object();

final dom.Element node;
final Scope _scope;
final RootScope _rootScope;
final Animate _animate;
final DestinationLightDom _lightDom;

Expand All @@ -14,7 +14,7 @@ class NgElement {

bool _writeScheduled = false;

NgElement(this.node, this._scope, this._animate, [this._lightDom]);
NgElement(this.node, this._rootScope, this._animate, [this._lightDom]);

void addClass(String className) {
_scheduleDomWrite();
Expand All @@ -40,7 +40,7 @@ class NgElement {
_scheduleDomWrite() {
if (!_writeScheduled) {
_writeScheduled = true;
_scope.rootScope.domWrite(() {
_rootScope.domWrite(() {
_writeToDom();
_notifyLightDom();
_writeScheduled = false;
Expand Down