← 返回
效率工具 中文

Angular

Avoid common Angular mistakes — subscription leaks, change detection, dependency injection, and module organization.
避免Angular常见错误:订阅泄漏、变更检测、依赖注入及模块组织。
ivangdavila
效率工具 clawhub v1.0.1 1 版本 99836.8 Key: 无需
★ 3
Stars
📥 1,775
下载
💾 34
安装
1
版本
#latest

概述

When to Use

User needs Angular expertise — component architecture, RxJS patterns, change detection, dependency injection, routing, and forms.

Quick Reference

TopicFile
-------------
Components & change detectioncomponents.md
RxJS & subscriptionsrxjs.md
Forms & validationforms.md
Dependency injectiondi.md
Routing & guardsrouting.md
HTTP & interceptorshttp.md

Common Mistakes

  • OnPush with mutated objects won't trigger change detection — always create new reference: {...obj} or [...arr]
  • @ViewChild is undefined in constructor/ngOnInit — access in ngAfterViewInit or later
  • *ngFor without trackBy re-renders entire list on any change — add trackBy returning stable ID
  • Manual subscribe() without unsubscribe leaks memory — use async pipe, takeUntilDestroyed(), or unsubscribe in ngOnDestroy
  • HttpClient returns cold Observable — each subscribe() fires new HTTP request
  • setTimeout/setInterval outside NgZone — change detection won't run, use NgZone.run() or signals
  • Circular DI dependency crashes app — use forwardRef() or restructure services
  • ElementRef.nativeElement direct DOM access breaks SSR — use Renderer2 or @defer
  • Route params via snapshot miss navigation changes — use paramMap Observable for same-component navigation
  • setValue() on FormGroup requires ALL fields — use patchValue() for partial updates

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-28 23:04 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 438 📥 147,668
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,358 📥 318,384
productivity

Weather

steipete
获取当前天气和预报(无需API密钥)
★ 445 📥 226,304