Migrate from AngularJS to Angular using hybrid mode

Angular migration

by wshobson · MIT license · ★ 39,857 on GitHub · updated Sep 21

Angular migration cover

Migrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.

---
name: angular-migration
description: Migrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.
---

# Angular Migration

Master AngularJS to Angular migration, including hybrid apps, component conversion, dependency injection changes, and routing migration.

## When to Use This Skill

- Migrating AngularJS (1.x) applications to Angular (2+)
- Running hybrid AngularJS/Angular applications
- Converting directives to components
- Modernizing dependency injection
- Migrating routing systems
- Updating to latest Angular versions
- Implementing Angular best practices

Overview

Master AngularJS to Angular migration, including hybrid apps, component conversion, dependency injection changes, and routing migration.

Manual install (npx, ZIP)
Claude Codenpx skills add wshobson/agents --skill angular-migration -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \ | tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/framework-migration/skills/angular-migration
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/06bc5683b39e91e9e39b/angular-migration.zip" -OutFile "$env:TEMP\angular-migration.zip"; Expand-Archive "$env:TEMP\angular-migration.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md7.0 KB
  • references/1 file · 1.8 KB
Read the files here
wshobson/4236bb92 files
SKILL.md
Show the full text314 lines

Angular Migration

Master AngularJS to Angular migration, including hybrid apps, component conversion, dependency injection changes, and routing migration.

When to Use This Skill

  • Migrating AngularJS (1.x) applications to Angular (2+)
  • Running hybrid AngularJS/Angular applications
  • Converting directives to components
  • Modernizing dependency injection
  • Migrating routing systems
  • Updating to latest Angular versions
  • Implementing Angular best practices

Migration Strategies

1. Big Bang (Complete Rewrite)
  • Rewrite entire app in Angular
  • Parallel development
  • Switch over at once
  • Best for: Small apps, green field projects
2. Incremental (Hybrid Approach)
  • Run AngularJS and Angular side-by-side
  • Migrate feature by feature
  • ngUpgrade for interop
  • Best for: Large apps, continuous delivery
3. Vertical Slice
  • Migrate one feature completely
  • New features in Angular, maintain old in AngularJS
  • Gradually replace
  • Best for: Medium apps, distinct features

Hybrid App Setup

// main.ts - Bootstrap hybrid app
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);
    // Bootstrap AngularJS
    upgrade.bootstrap(document.body, ["myAngularJSApp"], { strictDi: true });
  });
// app.module.ts
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { UpgradeModule } from "@angular/upgrade/static";

@NgModule({
  imports: [BrowserModule, UpgradeModule],
})
export class AppModule {
  constructor(private upgrade: UpgradeModule) {}

  ngDoBootstrap() {
    // Bootstrapped manually in main.ts
  }
}

Component Migration

AngularJS Controller → Angular Component
// Before: AngularJS controller
angular
  .module("myApp")
  .controller("UserController", function ($scope, UserService) {
    $scope.user = {};

    $scope.loadUser = function (id) {
      UserService.getUser(id).then(function (user) {
        $scope.user = user;
      });
    };

    $scope.saveUser = function () {
      UserService.saveUser($scope.user);
    };
  });
// After: Angular component
import { Component, OnInit } from "@angular/core";
import { UserService } from "./user.service";

@Component({
  selector: "app-user",
  template: `
    <div>
      <h2>{{ user.name }}</h2>
      <button (click)="saveUser()">Save</button>
    </div>
  `,
})
export class UserComponent implements OnInit {
  user: any = {};

  constructor(private userService: UserService) {}

  ngOnInit() {
    this.loadUser(1);
  }

  loadUser(id: number) {
    this.userService.getUser(id).subscribe((user) => {
      this.user = user;
    });
  }

  saveUser() {
    this.userService.saveUser(this.user);
  }
}
AngularJS Directive → Angular Component
// Before: AngularJS directive
angular.module("myApp").directive("userCard", function () {
  return {
    restrict: "E",
    scope: {
      user: "=",
      onDelete: "&",
    },
    template: `
      <div class="card">
        <h3>{{ user.name }}</h3>
        <button ng-click="onDelete()">Delete</button>
      </div>
    `,
  };
});
// After: Angular component
import { Component, Input, Output, EventEmitter } from "@angular/core";

@Component({
  selector: "app-user-card",
  template: `
    <div class="card">
      <h3>{{ user.name }}</h3>
      <button (click)="delete.emit()">Delete</button>
    </div>
  `,
})
export class UserCardComponent {
  @Input() user: any;
  @Output() delete = new EventEmitter<void>();
}

// Usage: <app-user-card [user]="user" (delete)="handleDelete()"></app-user-card>

Service Migration

// Before: AngularJS service
angular.module("myApp").factory("UserService", function ($http) {
  return {
    getUser: function (id) {
      return $http.get("/api/users/" + id);
    },
    saveUser: function (user) {
      return $http.post("/api/users", user);
    },
  };
});
// After: Angular service
import { Injectable } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs";

@Injectable({
  providedIn: "root",
})
export class UserService {
  constructor(private http: HttpClient) {}

  getUser(id: number): Observable<any> {
    return this.http.get(`/api/users/${id}`);
  }

  saveUser(user: any): Observable<any> {
    return this.http.post("/api/users", user);
  }
}

Dependency Injection Changes

Downgrading Angular → AngularJS
// Angular service
import { Injectable } from "@angular/core";

@Injectable({ providedIn: "root" })
export class NewService {
  getData() {
    return "data from Angular";
  }
}

// Make available to AngularJS
import { downgradeInjectable } from "@angular/upgrade/static";

angular.module("myApp").factory("newService", downgradeInjectable(NewService));

// Use in AngularJS
angular.module("myApp").controller("OldController", function (newService) {
  console.log(newService.getData());
});
Upgrading AngularJS → Angular
// AngularJS service
angular.module('myApp').factory('oldService', function() {
  return {
    getData: function() {
      return 'data from AngularJS';
    }
  };
});

// Make available to Angular
import { InjectionToken } from '@angular/core';

export const OLD_SERVICE = new InjectionToken<any>('oldService');

@NgModule({
  providers: [
    {
      provide: OLD_SERVICE,
      useFactory: (i: any) => i.get('oldService'),
      deps: ['$injector']
    }
  ]
})

// Use in Angular
@Component({...})
export class NewComponent {
  constructor(@Inject(OLD_SERVICE) private oldService: any) {
    console.log(this.oldService.getData());
  }
}

Routing Migration

// Before: AngularJS routing
angular.module("myApp").config(function ($routeProvider) {
  $routeProvider
    .when("/users", {
      template: "<user-list></user-list>",
    })
    .when("/users/:id", {
      template: "<user-detail></user-detail>",
    });
});
// After: Angular routing
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";

const routes: Routes = [
  { path: "users", component: UserListComponent },
  { path: "users/:id", component: UserDetailComponent },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
})
export class AppRoutingModule {}

Additional patterns and templates

More detailed templates and worked examples live in references/details.md. Read that file for the full pattern library.

1---
2name: angular-migration
3description: Migrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.
4---
5 
6# Angular Migration
7 
8Master AngularJS to Angular migration, including hybrid apps, component conversion, dependency injection changes, and routing migration.
9 
10## When to Use This Skill
11 
12- Migrating AngularJS (1.x) applications to Angular (2+)
13- Running hybrid AngularJS/Angular applications
14- Converting directives to components
15- Modernizing dependency injection
16- Migrating routing systems
17- Updating to latest Angular versions
18- Implementing Angular best practices
19 
20## Migration Strategies
21 
22### 1. Big Bang (Complete Rewrite)
23 
24- Rewrite entire app in Angular
25- Parallel development
26- Switch over at once
27- **Best for:** Small apps, green field projects
28 
29### 2. Incremental (Hybrid Approach)
30 
31- Run AngularJS and Angular side-by-side
32- Migrate feature by feature
33- ngUpgrade for interop
34- **Best for:** Large apps, continuous delivery
35 
36### 3. Vertical Slice
37 
38- Migrate one feature completely
39- New features in Angular, maintain old in AngularJS
40- Gradually replace
41- **Best for:** Medium apps, distinct features
42 
43## Hybrid App Setup
44 
45```typescript
46// main.ts - Bootstrap hybrid app
47import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
48import { UpgradeModule } from "@angular/upgrade/static";
49import { AppModule } from "./app/app.module";
50 
51platformBrowserDynamic()
52 .bootstrapModule(AppModule)
53 .then((platformRef) => {
54 const upgrade = platformRef.injector.get(UpgradeModule);
55 // Bootstrap AngularJS
56 upgrade.bootstrap(document.body, ["myAngularJSApp"], { strictDi: true });
57 });
58```
59 
60```typescript
61// app.module.ts
62import { NgModule } from "@angular/core";
63import { BrowserModule } from "@angular/platform-browser";
64import { UpgradeModule } from "@angular/upgrade/static";
65 
66@NgModule({
67 imports: [BrowserModule, UpgradeModule],
68})
69export class AppModule {
70 constructor(private upgrade: UpgradeModule) {}
71 
72 ngDoBootstrap() {
73 // Bootstrapped manually in main.ts
74 }
75}
76```
77 
78## Component Migration
79 
80### AngularJS Controller → Angular Component
81 
82```javascript
83// Before: AngularJS controller
84angular
85 .module("myApp")
86 .controller("UserController", function ($scope, UserService) {
87 $scope.user = {};
88 
89 $scope.loadUser = function (id) {
90 UserService.getUser(id).then(function (user) {
91 $scope.user = user;
92 });
93 };
94 
95 $scope.saveUser = function () {
96 UserService.saveUser($scope.user);
97 };
98 });
99```
100 
101```typescript
102// After: Angular component
103import { Component, OnInit } from "@angular/core";
104import { UserService } from "./user.service";
105 
106@Component({
107 selector: "app-user",
108 template: `
109 <div>
110 <h2>{{ user.name }}</h2>
111 <button (click)="saveUser()">Save</button>
112 </div>
113 `,
114})
115export class UserComponent implements OnInit {
116 user: any = {};
117 
118 constructor(private userService: UserService) {}
119 
120 ngOnInit() {
121 this.loadUser(1);
122 }
123 
124 loadUser(id: number) {
125 this.userService.getUser(id).subscribe((user) => {
126 this.user = user;
127 });
128 }
129 
130 saveUser() {
131 this.userService.saveUser(this.user);
132 }
133}
134```
135 
136### AngularJS Directive → Angular Component
137 
138```javascript
139// Before: AngularJS directive
140angular.module("myApp").directive("userCard", function () {
141 return {
142 restrict: "E",
143 scope: {
144 user: "=",
145 onDelete: "&",
146 },
147 template: `
148 <div class="card">
149 <h3>{{ user.name }}</h3>
150 <button ng-click="onDelete()">Delete</button>
151 </div>
152 `,
153 };
154});
155```
156 
157```typescript
158// After: Angular component
159import { Component, Input, Output, EventEmitter } from "@angular/core";
160 
161@Component({
162 selector: "app-user-card",
163 template: `
164 <div class="card">
165 <h3>{{ user.name }}</h3>
166 <button (click)="delete.emit()">Delete</button>
167 </div>
168 `,
169})
170export class UserCardComponent {
171 @Input() user: any;
172 @Output() delete = new EventEmitter<void>();
173}
174 
175// Usage: <app-user-card [user]="user" (delete)="handleDelete()"></app-user-card>
176```
177 
178## Service Migration
179 
180```javascript
181// Before: AngularJS service
182angular.module("myApp").factory("UserService", function ($http) {
183 return {
184 getUser: function (id) {
185 return $http.get("/api/users/" + id);
186 },
187 saveUser: function (user) {
188 return $http.post("/api/users", user);
189 },
190 };
191});
192```
193 
194```typescript
195// After: Angular service
196import { Injectable } from "@angular/core";
197import { HttpClient } from "@angular/common/http";
198import { Observable } from "rxjs";
199 
200@Injectable({
201 providedIn: "root",
202})
203export class UserService {
204 constructor(private http: HttpClient) {}
205 
206 getUser(id: number): Observable<any> {
207 return this.http.get(`/api/users/${id}`);
208 }
209 
210 saveUser(user: any): Observable<any> {
211 return this.http.post("/api/users", user);
212 }
213}
214```
215 
216## Dependency Injection Changes
217 
218### Downgrading Angular → AngularJS
219 
220```typescript
221// Angular service
222import { Injectable } from "@angular/core";
223 
224@Injectable({ providedIn: "root" })
225export class NewService {
226 getData() {
227 return "data from Angular";
228 }
229}
230 
231// Make available to AngularJS
232import { downgradeInjectable } from "@angular/upgrade/static";
233 
234angular.module("myApp").factory("newService", downgradeInjectable(NewService));
235 
236// Use in AngularJS
237angular.module("myApp").controller("OldController", function (newService) {
238 console.log(newService.getData());
239});
240```
241 
242### Upgrading AngularJS → Angular
243 
244```typescript
245// AngularJS service
246angular.module('myApp').factory('oldService', function() {
247 return {
248 getData: function() {
249 return 'data from AngularJS';
250 }
251 };
252});
253 
254// Make available to Angular
255import { InjectionToken } from '@angular/core';
256 
257export const OLD_SERVICE = new InjectionToken<any>('oldService');
258 
259@NgModule({
260 providers: [
261 {
262 provide: OLD_SERVICE,
263 useFactory: (i: any) => i.get('oldService'),
264 deps: ['$injector']
265 }
266 ]
267})
268 
269// Use in Angular
270@Component({...})
271export class NewComponent {
272 constructor(@Inject(OLD_SERVICE) private oldService: any) {
273 console.log(this.oldService.getData());
274 }
275}
276```
277 
278## Routing Migration
279 
280```javascript
281// Before: AngularJS routing
282angular.module("myApp").config(function ($routeProvider) {
283 $routeProvider
284 .when("/users", {
285 template: "<user-list></user-list>",
286 })
287 .when("/users/:id", {
288 template: "<user-detail></user-detail>",
289 });
290});
291```
292 
293```typescript
294// After: Angular routing
295import { NgModule } from "@angular/core";
296import { RouterModule, Routes } from "@angular/router";
297 
298const routes: Routes = [
299 { path: "users", component: UserListComponent },
300 { path: "users/:id", component: UserDetailComponent },
301];
302 
303@NgModule({
304 imports: [RouterModule.forRoot(routes)],
305 exports: [RouterModule],
306})
307export class AppRoutingModule {}
308```
309 
310## Additional patterns and templates
311 
312More detailed templates and worked examples live in `references/details.md`. Read that file for the full pattern library.
313 
314 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 39,857
Checked
Source
wshobson/agents ↗
Creator
wshobson · 179 listings
View creator

Similar skills

See all →
MCP3-5 days | Agents: 6 | Gate Keepers: DevOps Automator +⚙️ Phase 2 Playbook — Foundation & Scaffoldingmsitarzewski/agency-agents · by msitarzewski> Duration: 3-5 days | Agents: 6 | Gate Keepers: DevOps Automator + Evidence Collector★ 154k GitHub starsMCPNEXUS transforms The Agency's independent AI specialists🌐 NEXUS — Network of EXperts, Unified in Strategymsitarzewski/agency-agents · by msitarzewski> NEXUS transforms The Agency's independent AI specialists into a synchronized intelligence network. This is not a prompt collection — it…★ 154k GitHub starsSkillGenerate an Ansoff Matrix analysis mapping growth strategiesphuryn/pm-skills · by phurynGenerate an Ansoff Matrix analysis mapping growth strategies across market penetration, market development, product development, and diversification. Use when considering growth options, planning market expansion, or evaluating strategic growth paths.★ 26.6k GitHub starsSkillSurvey any codebase as a senior advisorImproveshadcn/improve · by shadcnSurvey any codebase as a senior advisor and produce prioritized, self-contained implementation plans for OTHER models/agents to execute. Strictly read-only on source code — never implements, fixes, or refactors anything itself. Use when asked to audit a codebase, find improvement opportunities (bugs, security, performance, test coverage, tech debt, migrations, DX), suggest features or where to take the project next (roadmap, product direction), or generate handoff plans for another agent to implement.★ 9.2k GitHub starsSkillTranslate skills from one industry to anotherCareer changer translatorParamchoudhary/ResumeSkills · by ParamchoudharyTranslate skills from one industry to another, identify transferable skills★ 2.4k GitHub starsSkillA collection of 37 battle-tested marketing skillsOpenClaw Marketing SkillsLeoYeAI/openclaw-marketing-skills · by LeoYeAIA collection of 37 battle-tested marketing skills for OpenClaw agents. Use when you want to install or reference any marketing skill including: CRO (page-cro, signup-flow-cro, onboarding-cro, form-cro, popup-cro, paywall-upgrade-cro), copywriting, copy-editing, cold-email, email-sequence, social-content, seo-audit, ai-seo, programmatic-seo, site-architecture, schema-markup, content-strategy, paid-ads, ad-creative, ab-test-setup, analytics-tracking, referral-program, free-tool-strategy, churn-prevention, revops, sales-enablement, launch-strategy, pricing-strategy, competitor-alternatives, marketing-ideas, marketing-psychology, lead-magnets, product-marketing-context, and data connectors (google-ads-connect, search-console-connect, meta-ads-connect, x-twitter-connect). Start with product-marketing-context to set up your product context document, then use any other skill naturally. Powered by MyClaw.ai.★ 1k GitHub stars

More from wshobson

SkillMaster C/.NET backend development patterns for buildingwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliancewshobson/agents · by wshobsonImplement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.★ 39.9k GitHub starsSkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Designwshobson/agents · by wshobsonMaster Material Design 3 and Jetpack Compose patterns for building native Android apps. Use when designing Android interfaces, implementing Compose UI, or following Google's Material Design guidelines.★ 39.9k GitHub starsSkillUnderstand anti-reversing, obfuscationAnti reversing techniqueswshobson/agents · by wshobsonUnderstand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use this skill when analyzing malware evasion techniques, when implementing anti-debugging protections for CTF challenges, when reverse engineering packed binaries, or when building security research tools that need to detect virtualized environments.★ 39.9k GitHub starsSkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patternswshobson/agents · by wshobsonBuild production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.★ 39.9k GitHub starsSkillOptimize Apache Spark jobs with partitioning, cachingApache Spark Optimizationwshobson/agents · by wshobsonOptimize Apache Spark jobs with partitioning, caching, shuffle optimization, and memory tuning. Use when improving Spark performance, debugging slow jobs, or scaling data processing pipelines.★ 39.9k GitHub stars