填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

ChangeDetectionStrategy

預設變更檢測器用來檢測更改的策略。設定後,將在下次觸發變更檢測時生效。

The strategy that the default change detector uses to detect changes. When set, takes effect the next time change detection is triggered.

參見

      
      enum ChangeDetectionStrategy {
  OnPush: 0
  Default: 1
}
    

成員列表

成員說明
OnPush: 0

使用 CheckOnce 策略,這意味著把此策略設定為 DefaultCheckAlways )將禁用自動變更檢測,直到重新啟用。變更檢測仍然可以顯式呼叫。此策略適用於所有子指令,並且不能被覆蓋。

Use the CheckOnce strategy, meaning that automatic change detection is deactivated until reactivated by setting the strategy to Default (CheckAlways). Change detection can still be explicitly invoked. This strategy applies to all child directives and cannot be overridden.

Default: 1

使用預設的 CheckAlways 策略,在該策略中,變更檢測將自動執行,直到顯式停用為止。

Use the default CheckAlways strategy, in which change detection is automatic until explicitly deactivated.