angular-ui-patterns
使用經驗證的模式打造穩健的 Angular UI
建立可靠的 Angular 介面需要一致地處理載入狀態、錯誤與空白狀態。本技能提供久經實戰驗證的模式,確保使用者始終了解你的應用程式正在發生什麼。
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「angular-ui-patterns」。 A component that fetches and displays user posts
預期結果:
- 元件在初次載入時顯示骨架載入器(尚無資料)
- 資料到達但為空時,顯示空白狀態與「Create Post」按鈕
- API 回傳錯誤時,在保留快取資料可見的同時顯示可重試的錯誤提示
- 成功載入後,渲染完整貼文清單並具備正確的無障礙屬性
正在使用「angular-ui-patterns」。 A save button in a settings form
預期結果:
- 按鈕僅在表單有效時可用
- 點擊後按鈕停用並顯示帶有「Saving...」文字的旋轉指示
- 成功時顯示綠色勾號與「Saved!」,2 秒後回復
- 失敗時顯示紅色 X 與錯誤訊息,並重新啟用按鈕以便重試
安全審計
安全Documentation-only skill containing Angular UI pattern guidance. All 63 static analysis findings are false positives: URLs are documentation references (not network calls), backticks are markdown code fencing (not shell execution), and crypto detections are text pattern misidentifications. No executable code, network requests, or command execution present.
品質評分
你能建構什麼
打造資料驅動儀表板的前端開發者
在從多個 API 擷取資料且延遲不一的儀表板元件中,實作一致的載入、錯誤與空白狀態。
建立 UI 標準的團隊主管
定義全組織的狀態管理、錯誤處理與使用者回饋模式,確保跨團隊一致的使用者體驗。
生成 Angular 元件的 AI 助手
引導 Claude 或 Codex 產生遵循已驗證狀態處理模式的 Angular 元件,避免常見陷阱,例如無聲錯誤或缺少載入狀態。
試試這些提示
Create an Angular component that displays a list of items. Show a skeleton loader when loading with no data, an empty state when the list is empty, an error state with retry when loading fails, and the actual data when available. Use Angular Signals and modern control flow.
Build an Angular form component with reactive forms validation. Show inline error messages for invalid fields, disable the submit button during form submission, display a loading indicator on the button, and show success or error toast notifications after the async operation completes.
Implement an Angular page that loads critical content immediately and defers non-critical sections like comments, related items, or analytics using @defer. Include placeholder, loading, and error states for each deferred block with appropriate minimum loading times.
Create a delete confirmation dialog pattern that shows a modal asking for confirmation, applies optimistic UI updates when confirmed, rolls back changes if the server request fails, and displays appropriate feedback to the user throughout the process.
最佳實務
- 務必向使用者顯示錯誤—不要在沒有回饋的情況下悄悄捕捉例外
- 只有在沒有既有資料時才顯示載入指示,以避免內容閃爍
- 在非同步操作期間停用動作按鈕,防止重複提交
避免
- 在已有快取資料時仍顯示 spinner—會在重新取得資料時造成不必要的視覺閃爍
- 在 catch 區塊吞掉錯誤而未告知使用者失敗
- 未在處理期間停用而允許提交按鈕被快速連點