This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
docs(guide/Running in Production): ng-strict-di #9908
Closed
Closed
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e106371
docs(guide/Running in Production): ng-strict-di
40fbdc9
Using link helper
43877e7
docs(guide/Running in Production): ng-strict-di
22ba437
docs(guide/Running in Production): ng-strict-di
22a87b6
docs(guide/Running in Production): ng-strict-di
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't necessarily something we'd recommend, because these tools just don't do a very good job.
Also, I'd be questionable about the "performance benefit", we've never measured a performance benefit and that was never the intent of strict-DI --- it's really a debugging tool, that's about it. The main benefit of using it in production is so that you can be sure your minified scripts won't be broken terribly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've built countless apps in angular using ng-annotate. When you say they don't do a very good job, I'm a little lost... It works really well... Especially since the alternative is to either explicitly annotate yourself (just realized I was using the opposite word for what I meant, this should say "automate the explicit annotation" I'll fix that...) or go with implicit annotation which is less performant and not minification safe.
Also, strict-di mode is more than a debugging tool. It encourages (enforces) explicit annotation which does have pretty significant performance gains over implicit (see jsperf) so I think it's good to encourage the use of it in production.
I'm going to make some wording corrections, but I definitely feel like this is something that we should be recommending for use in production...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why they don't work very well, is that they only are able to figure out certain cases where it's clear that stuff can be annotated correctly. They work considerably less well for other constructs people like to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, and I use such constructs in many cases. But it's very easy to work around. Much easier than managing the annotations myself. Plus, on the di guide we're already recommending using ng-annotate..........
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright alright, but you should at least make a reference to the real reasons why we added strictDI --- it's there to help you make sure that your code will work when minified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note added.