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

Conversation

rkirov
Copy link
Contributor

@rkirov rkirov commented Sep 12, 2014

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.

@jbdeboer
Copy link
Contributor

This is an awkward pattern. It requires a call to appInjector each time something gets ngElement.

Could you get a reference to RootScope into DirectiveInjector instead?

NgElement only uses scope to access rootScope, so now we directly inject
RootScope.

This is needed for future change dart-archive#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.
@rkirov
Copy link
Contributor Author

rkirov commented Sep 22, 2014

Rebased and resolved James' concern offline. Since ngElement is lazily created and most directives do not use it, the cost of eagerly grabbing rootScope from appInjector might be too much. Also ngElement is cached in the directive injector.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

4 participants