PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Angular · Theory

Change Detection

← All stacks

Theory

29/43

Change Detection

Default change detection checks the tree after events. OnPush checks when inputs change by reference, or you markForCheck, or an event fires inside that component.

Board: OnPush table. Push into students array. Screen stays old. Assign students = [...students, row] and it updates. Trap: mutating under OnPush and blaming Angular.

Exam tip

OnPush + new array reference demo.

Example

import { Component } from "@angular/core";

@Component({
  selector: "app-root",
  template: `
    <h1>{{ title }}</h1>
    <button (click)="toggle()">Toggle</button>
    <p *ngIf="open">Panel open</p>
  `,
})
export class AppComponent {
  title = "Angular practice";
  open = true;
  toggle() {
    this.open = !this.open;
  }
}

Change Detection: toggle open. Say whether the panel is on screen after one click.

Short notes

  • DefDefault checks often. OnPush checks on new refs / events.
  • RuleImmutable updates under OnPush.
  • TrapMutate array, nothing redraws.

Questions

1

Why OnPush looks ‘stuck’?

Previous← SignalsNextDynamic Comp →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.