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

44 lines
1.6 KiB
Plaintext
Raw Normal View History

2015-04-19 13:53:18 -07:00
2015-04-22 08:06:51 -07:00
p.location-badge.
2015-04-23 08:27:36 -07:00
exported from <a href="/angular2/change_detection.html">angular2/change_detection</a>
2015-04-19 13:53:18 -07:00
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-26 08:01:04 -07:00
- <a href='DynamicChangeDetection-class.html'><code>DynamicChangeDetection</code></a>: slower, but does not require `eval()`.
- <a href='JitChangeDetection-class.html'><code>JitChangeDetection</code></a>: faster, but requires `eval()`.
2015-04-19 13:53:18 -07:00
2015-04-20 13:57:43 -07:00
In JavaScript, you should always use `JitChangeDetection`, unless you are in an environment that has
2015-04-19 13:53:18 -07:00
[CSP](https://developer.mozilla.org/en-US/docs/Web/Security/CSP), such as a Chrome Extension.
2015-04-20 13:57:43 -07:00
In Dart, use `DynamicChangeDetection` during development. The Angular transformer generates an analog to the
`JitChangeDetection` strategy at compile time.
2015-04-19 13:53:18 -07:00
2015-04-26 08:01:04 -07:00
See: <a href='DynamicChangeDetection-class.html'><code>DynamicChangeDetection</code></a>, <a href='JitChangeDetection-class.html'><code>JitChangeDetection</code></a>
2015-04-19 13:53:18 -07:00
# Example
```javascript
2015-04-28 06:22:25 -07:00
bootstrap(MyApp, [bind(ChangeDetection).toClass(DynamicChangeDetection)]);
2015-04-19 13:53:18 -07:00
```
.l-main-section
h2 Members
.l-sub-section
h3 createProtoChangeDetector
pre.prettyprint
code.
2015-05-18 17:39:04 -07:00
createProtoChangeDetector(name:string, bindingRecords:List, variableBindings:List, directiveRecords:List, changeControlStrategy:string=DEFAULT)
2015-04-19 13:53:18 -07:00
:markdown
2015-04-19 13:53:18 -07:00