Migrate from AngularJS 1.x to Angular 21#46
Conversation
- Replace AngularJS 1.5.8 with Angular 21.2.x - Replace Gulp/Bower build system with Angular CLI - Convert all controllers to standalone Angular components - Convert all AngularJS services to Angular injectable services - Convert all directives to Angular components - Migrate routing from ui-router to @angular/router with lazy loading - Update all templates from AngularJS syntax to Angular control flow - Upgrade Bootstrap 3.3.5 to Bootstrap 5.3.x - Consolidate chart libraries (Morris, Chartist, amCharts) into Chart.js v4 - Replace angular-smart-table with custom sortable/searchable component - Replace ng-js-tree with native recursive tree component - Add reactive forms alongside template-driven forms - Add MIGRATION_NOTES.md documenting all changes
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
… reset - Use inject() for ThemeConfigService in SidebarService so it is available during field initialization (ES2022 useDefineForClassFields runs field initializers before constructor body) - Reset currentPage to 1 when search filters reduce results below the current page range in SmartTableComponent
…enter - Remove state mutation from filteredData getter to avoid ExpressionChangedAfterItHasBeenCheckedError; clamp page in pagedData without mutating currentPage, and reset via onSearch() - Use $index for @for track in msg-center to avoid duplicate key errors from non-unique time values
Use $index for track in toasts and todo lists to prevent NG0955 errors when duplicate items are added
| &.menu-collapsed { | ||
| padding-left: 50px; | ||
| } |
There was a problem hiding this comment.
🔴 Sidebar collapse toggle is broken on wide screens — only main content padding changes, sidebar and header stay fixed
When the user clicks the hamburger menu toggle on a screen wider than 1200px, toggleMenuCollapsed() sets the menuCollapsed signal to true, which adds .menu-collapsed to <main> (app.component.html:3). However, only app.component.scss:10-12 responds to this class by changing padding-left from 180px to 50px. The sidebar itself stays at a fixed width: 180px (sidebar.component.scss:12) and the page-top header stays at left: 180px (page-top.component.scss:4). Neither component has any CSS rule tied to the collapsed state. This causes the main content area to shift left under the still-full-width sidebar, creating a broken overlapping layout. The original AngularJS code had dedicated .menu-collapsed CSS rules that shrank the sidebar to 52px and adjusted the header, but these were not migrated.
Missing CSS rules from original codebase
The original SASS had:
@media (min-width: 1200px) {
.menu-collapsed {
.al-main { margin-left: 50px; }
.al-footer { padding-left: 83px; }
}
}
@media (min-width: 501px) {
.menu-collapsed {
.al-sidebar { width: 52px; }
}
}None of these rules exist in the new code. The global styles.scss:66-84 only handles automatic collapse via media queries at ≤1200px, not manual toggle.
Prompt for agents
The sidebar collapse toggle button (hamburger icon) is wired up and changes state, but the visual response is incomplete. When .menu-collapsed is applied to <main>, only padding-left changes from 180px to 50px. The sidebar (sidebar.component.scss) stays at width: 180px and the page-top header (page-top.component.scss) stays at left: 180px. This causes the main content to overlap under the sidebar.
To fix this, you need to add CSS rules that respond to the collapsed state. There are several approaches:
1. Add global styles in styles.scss that handle .menu-collapsed for sidebar and page-top (similar to how the media queries already work at line 66-84).
2. Or pass the collapsed state into the sidebar and page-top components and adjust their styles dynamically.
At minimum, when .menu-collapsed is active on <main>:
- .al-sidebar should shrink to ~50px width with text labels hidden
- .page-top should shift to left: 50px
Files to modify: src/styles.scss (add .menu-collapsed rules), or src/app/theme/components/sidebar/sidebar.component.scss and src/app/theme/components/page-top/page-top.component.scss (add dynamic class bindings).
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Fixed — added .menu-collapsed rules in global styles.scss that shrink .al-sidebar to 50px, hide text labels/submenu arrows/sublists, and shift .page-top left to 50px. This mirrors the original AngularJS SASS rules that were missing. See 03baa23.
- Add .menu-collapsed rules in global styles to shrink sidebar to 50px, hide text labels, and shift page-top header when toggle is clicked - Add document:click HostListener to MsgCenterComponent to close notification dropdown when clicking outside - Add document:click HostListener to PageTopComponent to close profile dropdown when clicking outside
Summary
Complete migration of the BlurAdmin dashboard application from AngularJS 1.5.8 to Angular 21 (latest).
Changes
ng build,ng serve)$stateProvider) →@angular/routerwith lazy-loaded routesng-repeat,ng-if,ng-click,ng-model) to Angular control flow (@for,@if,(click),[(ngModel)])@Injectableservices using Angular signals for stateMIGRATION_NOTES.mdcovering all patterns, conversions, and known issuesComponents migrated
inject(), ThemeConfigService)Bug fixes from review
SidebarServicefield initializer crash: switched toinject(ThemeConfigService)so the dependency is available during field initialization under ES2022useDefineForClassFieldssemanticscurrentPagenow resets to 1 when search results shrink below the current page rangeBuild verified
ng buildcompletes successfully with no errors.Review & Testing Checklist for Human
npm install && ng buildto verify the build passes locallyng serveand navigate all routes to verify routing works (dashboard, ui/, components/, charts/, maps/, tables/, form/, profile)Notes
@fullcalendar/angularto restore)leaflet+@asymmetrik/ngx-leafletto restore)MIGRATION_NOTES.mdfor comprehensive documentation of all patterns converted, third-party dependency replacements, and manual interventions neededLink to Devin session: https://partner-workshops.devinenterprise.com/sessions/481ede263d7b46fe924b1c97f5945b7d
Requested by: @bsmitches