Skip to content

Commit c6bde52

Browse files
btfordvojtajina
authored andcommitted
docs(debugInfo): add docs for $compileProvider.debugInfoEnabled()
1 parent 563be7e commit c6bde52

File tree

4 files changed

+48
-13
lines changed

4 files changed

+48
-13
lines changed

docs/content/guide/index.ngdoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ This is a short list of libraries with specific support and documentation for wo
8181

8282
### General
8383

84+
* **Docs Page:** {@link guide/production Running an AngularJS App in Production}
8485
* **Javascript minification: **[Background](http://thegreenpizza.github.io/2013/05/25/building-minification-safe-angular.js-applications/), [ng-annotate automation tool](https://github.com/olov/ng-annotate)
8586
* **Analytics and Logging:** [Angularyitcs (Google Analytics)](http://ngmodules.org/modules/angularytics), [Angulartics (Analytics)](https://github.com/luisfarzati/angulartics), [Logging Client-Side Errors](http://www.bennadel.com/blog/2542-Logging-Client-Side-Errors-With-AngularJS-And-Stacktrace-js.htm)
8687
* **SEO:** [By hand](http://www.yearofmoo.com/2012/11/angularjs-and-seo.html), [prerender.io](http://prerender.io/), [Brombone](http://www.brombone.com/), [SEO.js](http://getseojs.com/), [SEO4Ajax](http://www.seo4ajax.com/)

docs/content/guide/production.ngdoc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@ngdoc overview
2+
@name Running in Production
3+
@description
4+
5+
# Running an AngularJS App in Production
6+
7+
There are a few things you might consider when running your AngularJS application in production.
8+
9+
10+
## Disabling Debug Data
11+
12+
By default AngularJS attaches information about scopes to DOM nodes, and adds CSS classes
13+
to data-bound elements. The information that is not included is:
14+
15+
As a result of `ngBind`, `ngBindHtml` or `{{...}}` interpolations, binding data and CSS class
16+
`ng-class` is attached to the corresponding element.
17+
18+
Where the compiler has created a new scope, the scope and either `ng-scope` or `ng-isolated-scope`
19+
CSS class are attached to the corresponding element. These scope references can then be accessed via
20+
`element.scope()` and `element.isolateScope()`.
21+
22+
Tools like [Protractor](github.com/angular/protractor) and
23+
[Batarang](https://github.com/angular/angularjs-batarang) need this information to run,
24+
but you can disable this in production for a significant performance boost with:
25+
26+
```js
27+
myApp.config(['$compileProvider', function ($compileProvider) {
28+
$compileProvider.debugInfoEnabled(false);
29+
}]);
30+
```
31+
32+
If you wish to debug an application with this information then you should open up a debug
33+
console in the browser then call this method directly in this console:
34+
35+
```js
36+
angular.reloadWithDebugInfo();
37+
```
38+
39+
The page should reload and the debug information should now be available.
40+
41+
For more see the docs pages on {@link ng.$compileProvider#debugInfoEnabled `$compileProvider`}
42+
and {@link ng/function/angular.reloadWithDebugInfo `angular.reloadWithDebugInfo`}.

src/Angular.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,20 +1450,9 @@ function bootstrap(element, modules, config) {
14501450
* @module ng
14511451
* @description
14521452
* Use this function to reload the current application with debug information turned on.
1453+
* This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.
14531454
*
1454-
* To improve performance adding various debugging information can be disabled.
1455-
* See {@link $compileProvider#debugInfoEnabled}.
1456-
*
1457-
* This overrides any setting of `$compileProvider.debugInfoEnabled()` that you defined in your
1458-
* modules. If you wish to debug an application via this information then you should open up a debug
1459-
* console in the browser then call this method directly in this console:
1460-
*
1461-
* ```js
1462-
* angular.reloadWithDebugInfo();
1463-
* ```
1464-
*
1465-
* The page should reload and the debug information should now be available.
1466-
*
1455+
* See {@link ng.$compileProvider#debugInfoEnabled} for more.
14671456
*/
14681457
function reloadWithDebugInfo() {
14691458
window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;

src/ng/compile.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
685685
* * `ng-binding` CSS class
686686
* * `$binding` data property containing an array of the binding expressions
687687
*
688+
* You may want to use this in production for a significant performance boost. See
689+
* {@link guide/production#disabling-debug-data Disabling Debug Data} for more.
690+
*
688691
* The default value is true.
689692
*/
690693
var debugInfoEnabled = true;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy