From e10637139a67c82a818a1950b7bf0b9b63ae57d3 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Tue, 4 Nov 2014 12:36:18 -0700 Subject: [PATCH 1/5] docs(guide/Running in Production): ng-strict-di Adding note about Strict DI mode. --- docs/content/guide/production.ngdoc | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/content/guide/production.ngdoc b/docs/content/guide/production.ngdoc index f38428cacac4..8568cd8ea9b4 100644 --- a/docs/content/guide/production.ngdoc +++ b/docs/content/guide/production.ngdoc @@ -41,3 +41,34 @@ The page should reload and the debug information should now be available. For more see the docs pages on {@link ng.$compileProvider#debugInfoEnabled `$compileProvider`} and {@link angular.reloadWithDebugInfo `angular.reloadWithDebugInfo`}. + +## Strict DI Mode + +Using strict di mode in your production application will throw errors when a injectable +function is not +[annotated implicitly](https://docs.angularjs.org/guide/di#dependency-annotation#implicit-annotation). +This will force you to make sure that your injectable functions are implicitely annotated +which will improve angular's performance when injecting dependencies in your injectable +functions because it doesn't have to dynamically discover a function's dependencies. +It is recommended to automate the implicite annotation via a tool like +[ng-annotate](https://github.com/olov/ng-annotate) when you deploy to production (and enable +strict di mode) + +To enable strict di mode, you have two options: + +```html +
+ +
+``` + +or + +```js +angular.bootstrap(document, ['myApp'], { + strictDi: true +}); +``` + +For more information, see the +[DI Guide](https://docs.angularjs.org/guide/di#using-strict-dependency-injection). From 40fbdc9faa8b9d634cd6d6b2215341436de8a9f3 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Tue, 4 Nov 2014 13:10:41 -0700 Subject: [PATCH 2/5] Using link helper I think this is how it works :-/ Not sure how to test it though... --- docs/content/guide/production.ngdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/guide/production.ngdoc b/docs/content/guide/production.ngdoc index 8568cd8ea9b4..c13c4b8783ec 100644 --- a/docs/content/guide/production.ngdoc +++ b/docs/content/guide/production.ngdoc @@ -46,11 +46,11 @@ and {@link angular.reloadWithDebugInfo `angular.reloadWithDebugInfo`}. Using strict di mode in your production application will throw errors when a injectable function is not -[annotated implicitly](https://docs.angularjs.org/guide/di#dependency-annotation#implicit-annotation). +{@link di#implicit-annotation annotated implicitly}. This will force you to make sure that your injectable functions are implicitely annotated which will improve angular's performance when injecting dependencies in your injectable functions because it doesn't have to dynamically discover a function's dependencies. -It is recommended to automate the implicite annotation via a tool like +It is recommended to automate the implicit annotation via a tool like [ng-annotate](https://github.com/olov/ng-annotate) when you deploy to production (and enable strict di mode) From 43877e7f6dcd5b951ac8581cceec2748ee9315e9 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Tue, 4 Nov 2014 15:10:54 -0700 Subject: [PATCH 3/5] docs(guide/Running in Production): ng-strict-di Using @link helper and typeo fix. --- docs/content/guide/production.ngdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/guide/production.ngdoc b/docs/content/guide/production.ngdoc index c13c4b8783ec..bc19bda5d98f 100644 --- a/docs/content/guide/production.ngdoc +++ b/docs/content/guide/production.ngdoc @@ -47,7 +47,7 @@ and {@link angular.reloadWithDebugInfo `angular.reloadWithDebugInfo`}. Using strict di mode in your production application will throw errors when a injectable function is not {@link di#implicit-annotation annotated implicitly}. -This will force you to make sure that your injectable functions are implicitely annotated +This will force you to make sure that your injectable functions are implicitly annotated which will improve angular's performance when injecting dependencies in your injectable functions because it doesn't have to dynamically discover a function's dependencies. It is recommended to automate the implicit annotation via a tool like @@ -71,4 +71,4 @@ angular.bootstrap(document, ['myApp'], { ``` For more information, see the -[DI Guide](https://docs.angularjs.org/guide/di#using-strict-dependency-injection). +{@link di#using-strict-dependency-injection DI Guide}. From 22ba4373c749c0ed5cc1393b4acb91ef8784eb25 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Wed, 5 Nov 2014 11:46:18 -0700 Subject: [PATCH 4/5] docs(guide/Running in Production): ng-strict-di Implicit annotation was the opposite of what we're going for here (explicit) --- docs/content/guide/production.ngdoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/guide/production.ngdoc b/docs/content/guide/production.ngdoc index bc19bda5d98f..707747c1537d 100644 --- a/docs/content/guide/production.ngdoc +++ b/docs/content/guide/production.ngdoc @@ -46,11 +46,11 @@ and {@link angular.reloadWithDebugInfo `angular.reloadWithDebugInfo`}. Using strict di mode in your production application will throw errors when a injectable function is not -{@link di#implicit-annotation annotated implicitly}. -This will force you to make sure that your injectable functions are implicitly annotated +{@link di#dependency-annotation annotated explicitly}. +This will force you to make sure that your injectable functions are explicitly annotated which will improve angular's performance when injecting dependencies in your injectable functions because it doesn't have to dynamically discover a function's dependencies. -It is recommended to automate the implicit annotation via a tool like +It is recommended to automate the explicit annotation via a tool like [ng-annotate](https://github.com/olov/ng-annotate) when you deploy to production (and enable strict di mode) From 22a87b6c27987b950eb52e5259ad3cc331a4e6ea Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Wed, 5 Nov 2014 12:37:39 -0700 Subject: [PATCH 5/5] docs(guide/Running in Production): ng-strict-di Adding note about the purpose of strict di mode. --- docs/content/guide/production.ngdoc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/content/guide/production.ngdoc b/docs/content/guide/production.ngdoc index 707747c1537d..8632f3d1d0d0 100644 --- a/docs/content/guide/production.ngdoc +++ b/docs/content/guide/production.ngdoc @@ -46,11 +46,12 @@ and {@link angular.reloadWithDebugInfo `angular.reloadWithDebugInfo`}. Using strict di mode in your production application will throw errors when a injectable function is not -{@link di#dependency-annotation annotated explicitly}. -This will force you to make sure that your injectable functions are explicitly annotated -which will improve angular's performance when injecting dependencies in your injectable -functions because it doesn't have to dynamically discover a function's dependencies. -It is recommended to automate the explicit annotation via a tool like +{@link di#dependency-annotation annotated explicitly}. Strict di mode is intended to help +you make sure that your code will work when minified. However, it also will force you to +make sure that your injectable functions are explicitly annotated which will improve +angular's performance when injecting dependencies in your injectable functions because it +doesn't have to dynamically discover a function's dependencies. It is recommended to +automate the explicit annotation via a tool like [ng-annotate](https://github.com/olov/ng-annotate) when you deploy to production (and enable strict di mode)