Migrate from AngularJS to Angular using hybrid mode
Angular migration

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 Code
npx skills add wshobson/agents --skill angular-migration -g -a claude-codeClaude 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-migrationWindows (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" -ForceClaude.ai / desktop
Codex, Cursor, other agents
Connects with Agent Alley MCP · agentalley.io/mcp
Files included
SKILL.md7.0 KBreferences/1 file · 1.8 KB
Read the files here
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 | |
| 2 | name angular-migration |
| 3 | 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. |
| 4 | |
| 5 | |
| 6 | # Angular Migration |
| 7 | |
| 8 | Master 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 | |
| 46 | // main.ts - Bootstrap hybrid app |
| 47 | import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; |
| 48 | import { UpgradeModule } from "@angular/upgrade/static"; |
| 49 | import { AppModule } from "./app/app.module"; |
| 50 | |
| 51 | platformBrowserDynamic() |
| 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 | |
| 61 | // app.module.ts |
| 62 | import { NgModule } from "@angular/core"; |
| 63 | import { BrowserModule } from "@angular/platform-browser"; |
| 64 | import { UpgradeModule } from "@angular/upgrade/static"; |
| 65 | |
| 66 | @NgModule({ |
| 67 | imports: [BrowserModule, UpgradeModule], |
| 68 | }) |
| 69 | export 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 | |
| 83 | // Before: AngularJS controller |
| 84 | angular |
| 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 | |
| 102 | // After: Angular component |
| 103 | import { Component, OnInit } from "@angular/core"; |
| 104 | import { 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 | }) |
| 115 | export 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 | |
| 139 | // Before: AngularJS directive |
| 140 | angular.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 | |
| 158 | // After: Angular component |
| 159 | import { 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 | }) |
| 170 | export 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 | |
| 181 | // Before: AngularJS service |
| 182 | angular.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 | |
| 195 | // After: Angular service |
| 196 | import { Injectable } from "@angular/core"; |
| 197 | import { HttpClient } from "@angular/common/http"; |
| 198 | import { Observable } from "rxjs"; |
| 199 | |
| 200 | @Injectable({ |
| 201 | providedIn: "root", |
| 202 | }) |
| 203 | export 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 | |
| 221 | // Angular service |
| 222 | import { Injectable } from "@angular/core"; |
| 223 | |
| 224 | @Injectable({ providedIn: "root" }) |
| 225 | export class NewService { |
| 226 | getData() { |
| 227 | return "data from Angular"; |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | // Make available to AngularJS |
| 232 | import { downgradeInjectable } from "@angular/upgrade/static"; |
| 233 | |
| 234 | angular.module("myApp").factory("newService", downgradeInjectable(NewService)); |
| 235 | |
| 236 | // Use in AngularJS |
| 237 | angular.module("myApp").controller("OldController", function (newService) { |
| 238 | console.log(newService.getData()); |
| 239 | }); |
| 240 | |
| 241 | |
| 242 | ### Upgrading AngularJS → Angular |
| 243 | |
| 244 | |
| 245 | // AngularJS service |
| 246 | angular.module('myApp').factory('oldService', function() { |
| 247 | return { |
| 248 | getData: function() { |
| 249 | return 'data from AngularJS'; |
| 250 | } |
| 251 | }; |
| 252 | }); |
| 253 | |
| 254 | // Make available to Angular |
| 255 | import { InjectionToken } from '@angular/core'; |
| 256 | |
| 257 | export 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({...}) |
| 271 | export 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 | |
| 281 | // Before: AngularJS routing |
| 282 | angular.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 | |
| 294 | // After: Angular routing |
| 295 | import { NgModule } from "@angular/core"; |
| 296 | import { RouterModule, Routes } from "@angular/router"; |
| 297 | |
| 298 | const 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 | }) |
| 307 | export class AppRoutingModule {} |
| 308 | |
| 309 | |
| 310 | ## Additional patterns and templates |
| 311 | |
| 312 | More detailed templates and worked examples live in `references/details.md`. Read that file for the full pattern library. |
| 313 | |
| 314 |
Details
- Updated
- Sep 21, 2026
- License
- MIT
- Stars on the repo
- ★ 39,857
- Checked
- Source
- wshobson/agents ↗
- Creator
- wshobson · 179 listings
Similar skills
See all →
MCP3-5 days | Agents: 6 | Gate Keepers: DevOps Automator +⚙️ Phase 2 Playbook — Foundation & Scaffolding
MCPNEXUS transforms The Agency's independent AI specialists🌐 NEXUS — Network of EXperts, Unified in Strategy
SkillGenerate an Ansoff Matrix analysis mapping growth strategies
SkillSurvey any codebase as a senior advisorImprove
SkillTranslate skills from one industry to anotherCareer changer translator
SkillA collection of 37 battle-tested marketing skillsOpenClaw Marketing SkillsMore from wshobson
SkillMaster C/.NET backend development patterns for building
SkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliance
SkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Design
SkillUnderstand anti-reversing, obfuscationAnti reversing techniques
SkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patterns
SkillOptimize Apache Spark jobs with partitioning, cachingApache Spark Optimization