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

Commit a952ebb

Browse files
committed
refactor(NgElement): NgElement inject RootScope instead of Scope.
NgElement only uses scope to access rootScope, so now we directly inject RootScope. This is needed for future change #1429 which disallows Scope injection into controllers. Since NgElement depends on scope it would also be disallowed, unless we change it to directly use RootScope.
1 parent fd54c30 commit a952ebb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/core_dom/directive_injector.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class DirectiveInjector implements DirectiveBinder {
387387

388388
NgElement get ngElement {
389389
if (_ngElement == null) {
390-
_ngElement = new NgElement(_node, scope, _animate, _destLightDom);
390+
_ngElement = new NgElement(_node, _appInjector.getByKey(ROOT_SCOPE_KEY), _animate, _destLightDom);
391391
}
392392
return _ngElement;
393393
}

lib/core_dom/ng_element.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class NgElement {
55
static const _TO_BE_REMOVED = const Object();
66

77
final dom.Element node;
8-
final Scope _scope;
8+
final RootScope _rootScope;
99
final Animate _animate;
1010
final DestinationLightDom _lightDom;
1111

@@ -14,7 +14,7 @@ class NgElement {
1414

1515
bool _writeScheduled = false;
1616

17-
NgElement(this.node, this._scope, this._animate, [this._lightDom]);
17+
NgElement(this.node, this._rootScope, this._animate, [this._lightDom]);
1818

1919
void addClass(String className) {
2020
_scheduleDomWrite();
@@ -40,7 +40,7 @@ class NgElement {
4040
_scheduleDomWrite() {
4141
if (!_writeScheduled) {
4242
_writeScheduled = true;
43-
_scope.rootScope.domWrite(() {
43+
_rootScope.domWrite(() {
4444
_writeToDom();
4545
_notifyLightDom();
4646
_writeScheduled = false;

0 commit comments

Comments
 (0)