技能 angular-migration
📦

angular-migration

安全

將 AngularJS 遷移至 Angular

也可从以下获取: wshobson

此技能提供從傳統 AngularJS 應用程式遷移至現代 Angular 的全面指導,涵蓋混合式設定、元件轉換、服務遷移和路由模式。

支持: Claude Codex Code(CC)
🥉 75 青铜
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“angular-migration”。 How do I set up a hybrid AngularJS/Angular application?

预期结果:

To set up a hybrid application, you need to:

1. Install @angular/upgrade package
2. Bootstrap Angular first, then use UpgradeModule to bootstrap AngularJS
3. Configure your AppModule with both BrowserModule and UpgradeModule

Example main.ts:
```typescript
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { UpgradeModule } from '@angular/upgrade/static';
import { AppModule } from './app/app.module';

platformBrowserDynamic()
.bootstrapModule(AppModule)
.then(platformRef => {
const upgrade = platformRef.injector.get(UpgradeModule);
upgrade.bootstrap(document.body, ['myAngularJSApp'], { strictDi: true });
});
```

正在使用“angular-migration”。 What's the best approach for migrating a large AngularJS app?

预期结果:

For large applications, the Incremental (Hybrid) approach is recommended:

1. **Setup Phase**: Install Angular CLI, set up hybrid app with ngUpgrade
2. **Infrastructure Phase**: Migrate services, utilities, and shared components
3. **Feature Migration**: Migrate feature by feature, testing thoroughly
4. **Cleanup Phase**: Remove AngularJS code and ngUpgrade

This allows continuous delivery while gradually migrating the application.

安全审计

安全
v1 • 2/24/2026

This skill is a documentation file containing code examples and migration guides for AngularJS to Angular migration. Static findings flagged backticks (code fences), example API calls in code blocks, and references to assessment/setup tasks - all false positives. No actual security concerns detected.

1
已扫描文件
431
分析行数
0
发现项
1
审计总数
未发现安全问题
审计者: claude

质量评分

38
架构
100
可维护性
87
内容
50
社区
100
安全
100
规范符合性

你能构建什么

規劃 AngularJS 到 Angular 遷移

開發團隊規劃將其傳統 AngularJS 應用程式升級至現代 Angular,使用此技能來了解遷移策略並設定混合式應用程式。

轉換 AngularJS 元件

進行漸進式遷移的開發人員需要指導,以將 AngularJS 控制器和指令式元件轉換為具有適當 TypeScript 類型定義的 Angular 元件。

學習 Angular 遷移模式

不熟悉 Angular 的開發人員想要了解 AngularJS 和 Angular 之間的相依性注入運作方式有何不同,以及如何bridging這兩個框架。

试试这些提示

基本遷移策略
我需要將 AngularJS 應用程式遷移至 Angular。有哪些主要的遷移策略可用,對於大型企業應用程式我應該選擇哪一種?
混合式應用程式設定
如何使用 ngUpgrade 設定混合式 AngularJS/Angular 應用程式?向我展示啟動程序和模組配置。
元件轉換
將此 AngularJS 控制器轉換為 Angular 元件:(提供 AngularJS 程式碼)。向我展示具有適當匯入和裝飾器的 TypeScript 元件。
服務和 DI 遷移
如何降級 Angular 服務使其在 AngularJS 中可用,以及如何升級 AngularJS 工廠使其在 Angular 中運作?

最佳实践

  • 從服務開始遷移,因為它們比 UI 元件更容易轉換
  • 從一開始就使用 TypeScript 以利用遷移期間的類型安全
  • 在每個步驟持續測試,以在遷移過程早期發現問題
  • 遵循官方 Angular 風格指南來編寫遷移期間的所有新程式碼

避免

  • 避免在沒有適當的預備環境驗證和復原計劃的情況下進行一次性全面切換
  • 不要在遷移業務邏輯和服務之前遷移 UI 元件
  • 避免在同一功能內不一致地混合 AngularJS 和 Angular 模式

常见问题

什麼是 ngUpgrade?為什麼我需要它?
ngUpgrade 是一個 Angular 程式庫,可幫助您在同一個應用程式中執行 AngularJS 和 Angular。它提供 UpgradeModule,讓您可以在 Angular 應用程式中啟動 AngularJS 元件,並在 AngularJS 程式碼中使用 Angular 服務。
我應該選擇哪種遷移策略?
對於小型應用程式選擇一次性全面遷移,對於有持續交付需求的大型應用程式選擇漸進式(混合)方法,對於具有明確功能模組的中型應用程式選擇垂直切片方法。
我可以在 AngularJS 範本中使用 Angular 元件嗎?
是的,您可以使用 @angular/upgrade/static 中的 downgradeComponent 將 Angular 元件降級以便在 AngularJS 範本中使用。
如何處理相依性注入的差異?
AngularJS 使用隱式相依性注入搭配字串名稱。Angular 使用明確的相依性注入搭配類別和 Inject 裝飾器。使用 downgradeInjectable 和 upgradeModule 來bridging框架間的服務。
我應該遷移至回應式表單還是範本驅動式表單?
建議在大多數情況下使用回應式表單,因為它們提供更好的類型安全、更容易測試,以及對表單驗證邏輯的更多控制。
AngularJS 到 Angular 遷移通常需要多長時間?
遷移時間因應用程式大小、複雜度和團隊經驗而異。典型時間表為:設定(1-2 週)、基礎設施(2-4 週)、功能遷移(依應用程式大小而異)和清理(1-2 週)。

开发者详情

文件结构

📄 SKILL.md