![](/img/trans.png)
[英]Angular ChangeDetectorRef render live data
我正在嘗試獲取有關 angular 基本組件的實時數據。 我期望的是:HTML 渲染每 1 秒自動遞增一次(即:0、1、2、3、4、5..等) 我得到了什么:HTML 渲染:0 然后 1。(增加一次然后停止) Stackblitz url for demonstration (appologize ...
[英]Angular ChangeDetectorRef render live data
我正在嘗試獲取有關 angular 基本組件的實時數據。 我期望的是:HTML 渲染每 1 秒自動遞增一次(即:0、1、2、3、4、5..等) 我得到了什么:HTML 渲染:0 然后 1。(增加一次然后停止) Stackblitz url for demonstration (appologize ...
[英]Principe of Angular OnPush + Change detection work
有 3 個組件:Parent、Child、ChildChild: 父->子->子子。 它們都是 OnPush。 在 parent 和 childChild 上沒有 changeDetectorRef 和 setTimeout 3 秒,它們的模板屬性正在更改。 在 Central - Ch ...
[英]OnPush Changedetection for a http service
我想調用一個 http api 並使用 ChangeDetectionStrategy.OnPush 加載數據。 我知道如何通過調用 detectchanges() 使用 ChangeDetectorRef 來解決這個問題。 調用Service的主要組件是: invigilateService ...
[英]How can i cut away change detecion and prevent rerender by a simple class variable in Angular?
我制作了一個非常簡單的演示應用程序來解釋我想要做什么。 @Component({ selector: 'my-app', templateUrl: './app.component.html', styleUrls: [ './app.component.css' ] }) export ...
[英]Angular and Plotly: Method that provides data get called too often
我在 Angular 組件中有一個非常簡單的 Plotly 圖: getTemperatureData()方法返回包含數據的 object - 標准過程。 但是,即使數據未更新,該方法也會被一遍又一遍地調用。 例如,將鼠標懸停在 Plotly 圖或 Angular 輸入字段上會觸發該方法。 有沒有 ...
[英]Angular how to detect changes from parent to child in the following way
示例組件的數據為 object 數組,並且其數組循環中有子組件。 樣本.組件 現在我需要檢測 object 上的任何值從父級更改時的更改 我無法獲得更改,因為數據不是輸入值。 如何獲得孩子的變化? StackBlitz注意:這只是示例代碼,在現實數據中有大量 arrays 的 object 具有多 ...
[英]How to solve the "Expression Changed After It Has Been Checked Error" in Angular?
我想在 Angular 中實現一個聊天。 聊天的每個項目(消息)都有一個標題(標題/名稱),應該有一個特定的邊距。 邊距應根據 div 的高度計算。 代碼看起來像這樣。 問題出在 Chrome 瀏覽器中(在 Mozilla 中沒有問題)。 控制台錯誤是:“ExpressionChangedAft ...
[英]Angular 11 change detection issue
我在我的 html 視圖中有一個情況,我正在更新材質滑塊的綁定,如下所示: 但是當我的孩子組件通過this.thresholdValueSub.next(value)調用一個服務來更新它時; ,我收到了經典的更改檢測錯誤: 我以為我會通過在我看來使用async來解決它,但我錯了: 然后 ...
[英]What is the right way to use changeDetection.markForCheck() in Angular?
我正在使用markForCheck來檢測我的角度組件中的變化(其中有changeDetection: ChangeDetectionStrategy.OnPush ),最初,我將markForCheck放在函數的開頭, markForCheck我markForCheck ,然后我意識到放置它會更有意 ...
[英]How to check which changedetectionStrategy is used in component
有沒有辦法找出組件實際使用了哪個changedetectionStrategy。 我有一個非常大的 angular 應用程序,它在外部組件上使用 onPush,所以一切都應該使用 onPush。 但是當在一些子組件上額外應用 onPush 時,性能會有所提高。 該屏幕截圖顯示了當鼠標以幾乎完全相同 ...
[英]I got ExpressionChangedAfterItHasBeenCheckedError from child compoenent (timerrenderer), Angular 7
我從我的子組件中收到 ExpressionChangedAfterItHasBeenCheckedError 錯誤。 我嘗試在 ngOnchanges 中添加 detectChanges() 方法,但沒有成功。 我是 angular 的新手。 我也嘗試了其他問題的解決方案,但對我不起作用。 ...
[英]Angular 2 routing breaks (click) handler change detection
“初始化.ts” “home.module.ts” “home-app.component.ts” “home-feed.component.ts” “home-feed.html” 這是我的流程的基本實現。 我最初是路由到我的 HomeFeedComponent,但是一旦我在我的初始路由 ...
[英]ngOnChanges not triggered though I called ChangeDetectorRef.detectChanges
export class AppComponent implements OnInit, OnChanges { @Input() value: number; constructor( private cdr: ChangeDetectorRef ) {} ngOn ...
[英]Why do I need mark for check ? angular
我正在使用 angular 10,cdktable,我面臨以下問題。 當我在表格上執行搜索時,除非我單擊應用程序中的任何位置(它神奇地更新),否則我的分頁不會更新... 這是一個變更檢測問題,我的應用程序正在使用 onPush 策略。 現在,我的表正在從這個 observable 中獲取數據con ...
[英]Angular - change detection in dynamically loaded module/component without using `ChangeDetectorRef`
我用編譯器的compileModuleAsync編譯了一個 Angular 模塊(動態加載模塊),並希望將模塊的一個組件插入到視圖中。 我試圖將組件插入到ViewContainer中,但該組件不會自動檢測到更改。 每次更新組件的屬性時,我都應該調用changeDetectorRef.detectC ...