angular-cn/public/docs/js/latest/api/change_detection/ChangeDetection-class.jade

44 lines
1.7 KiB
Plaintext
Raw Normal View History

2015-04-19 16:53:18 -04:00
p.
<span class="location-badge">exported from <a href="/angular2/change_detection">angular2/change_detection</a></span>
defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/change_detection/interfaces.js#L34">angular2/src/change_detection/interfaces.js (line 34)</a>
:markdown
Interface used by Angular to control the change detection strategy for an application.
Angular implements the following change detection strategies by default:
2015-04-20 16:57:43 -04:00
- <a href="angular2/change_detection/DynamicChangeDetection-class"><code>DynamicChangeDetection</code></a>: slower, but does not require `eval()`.
- <a href="angular2/change_detection/JitChangeDetection-class"><code>JitChangeDetection</code></a>: faster, but requires `eval()`.
2015-04-19 16:53:18 -04:00
2015-04-20 16:57:43 -04:00
In JavaScript, you should always use `JitChangeDetection`, unless you are in an environment that has
2015-04-19 16:53:18 -04:00
[CSP](https://developer.mozilla.org/en-US/docs/Web/Security/CSP), such as a Chrome Extension.
2015-04-20 16:57:43 -04:00
In Dart, use `DynamicChangeDetection` during development. The Angular transformer generates an analog to the
`JitChangeDetection` strategy at compile time.
2015-04-19 16:53:18 -04:00
2015-04-20 16:57:43 -04:00
See: <a href="angular2/change_detection/DynamicChangeDetection-class"><code>DynamicChangeDetection</code></a>, <a href="angular2/change_detection/JitChangeDetection-class"><code>JitChangeDetection</code></a>
2015-04-19 16:53:18 -04:00
# Example
```javascript
bootstrap(MyApp, [bind(ChangeDetection).toValue(dynamicChangeDetection)]);
```
.l-main-section
h2 Members
.l-sub-section
h3 createProtoChangeDetector
pre.prettyprint
code.
2015-04-20 16:57:43 -04:00
createProtoChangeDetector(name:string, changeControlStrategy:string=DEFAULT)
2015-04-19 16:53:18 -04:00
:markdown