angular-cn/public/docs/js/latest/api/change_detection/ChangeDetection-class.jade
2015-04-19 13:53:18 -07:00

45 lines
1.3 KiB
Plaintext

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:
- [dynamicChangeDetection]: slower, but does not require `eval()`.
- [jitChangeDetection]: faster, but requires `eval()`.
In JavaScript, you should always use `jitChangeDetection`, unless you are in an environment that has
[CSP](https://developer.mozilla.org/en-US/docs/Web/Security/CSP), such as a Chrome Extension.
In Dart, use `dynamicChangeDetection` during development. The Angular transformer generates an analog to the
`jitChangeDetection` strategy at compile time.
See: [dynamicChangeDetection], [jitChangeDetection]
# Example
```javascript
bootstrap(MyApp, [bind(ChangeDetection).toValue(dynamicChangeDetection)]);
```
.l-main-section
h2 Members
.l-sub-section
h3 createProtoChangeDetector
pre.prettyprint
code.
(name:string, changeControlStrategy:string=DEFAULT)
:markdown