Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(analytics): removed providedIn: 'any' from the service injectable #2605

Merged
merged 1 commit into from
Oct 30, 2020
Merged

fix(analytics): removed providedIn: 'any' from the service injectable #2605

merged 1 commit into from
Oct 30, 2020

Conversation

jackcw
Copy link
Contributor

@jackcw jackcw commented Oct 1, 2020

Checklist

Description

The ScreenTrackingService and UserTrackingService would automatically be initialised even when not provided meaning you cant turn them off.

Code sample

Changed from

@Injectable({ providedIn: 'any' })

to

@Injectable()

Copy link
Contributor

@yasinkocak yasinkocak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be a singleton?

@Injectable({
  providedIn: 'root'
})

@jackcw
Copy link
Contributor Author

jackcw commented Oct 5, 2020

When i tried that @yasinkocak it triggers the screen_view event when its not provided. Only way to make it work that i saw was with removing providedIn all together

@jamesdaniels
Copy link
Member

Interesting, so the theses modules aren't tree-shaking out even if you don't provide them... weird. Let me dig into this a bit and see if we can address in a patch. Thanks for the help :)

Copy link
Member

@jamesdaniels jamesdaniels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good solution to me.

@jamesdaniels jamesdaniels merged commit 92f7aaf into angular:master Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants