Skip to content
This repository has been archived by the owner on May 30, 2019. It is now read-only.

$window on $rootScope. #24

Open
Remco75 opened this issue May 5, 2017 · 2 comments
Open

$window on $rootScope. #24

Remco75 opened this issue May 5, 2017 · 2 comments

Comments

@Remco75
Copy link

Remco75 commented May 5, 2017

The Metatags service exposes the $window service on its object. When the implementing app puts the Metatags service on the $rootScope the whole window object is in turn exposed on the $rootScope.

This feels like a big scope pollution, and might have performance impact.
as far as I can see there are 2 solutions

  1. Use a Weakmap outside the class to store $window as a 'private' member.
  2. Do not use window at all (I think it is only used for retreiving the absolute page URL, but the $state service can do that to.
@Remco75
Copy link
Author

Remco75 commented May 5, 2017

oh a 3rd way, do not expose the derrived metatags directly on the Metatag service but rather in an obeject that you put on the service, and we put that on the rootScope

@tinusn
Copy link
Owner

tinusn commented May 23, 2017

Either solution works, feel free to create a pull request

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

No branches or pull requests

2 participants