Successfully migrated 89 out of 105 @Input properties (85%) in the ngx-extended-pdf-viewer.component.ts file from Angular decorators to the new signals API.
- All simple
@Input()properties without custom setters/getters - Properties with default values, type annotations, and complex expressions
- Properties marked as required with
!(definite assignment assertion)
// Before
@Input()
public customFindbarInputArea: TemplateRef<any> | undefined;
// After
public customFindbarInputArea = input<TemplateRef<any>>();// Before
@Input()
public showTextEditor: ResponsiveVisibility = 'xxl';
// After
public showTextEditor = input<ResponsiveVisibility>('xxl');// Before
@Input()
public enableDragAndDrop = true;
// After
public enableDragAndDrop = input(true);// Before
@Input()
public showCommentEditor: ResponsiveVisibility = pdfDefaultOptions.enableComment ? 'xxl' : false;
// After
public showCommentEditor = input<ResponsiveVisibility>(pdfDefaultOptions.enableComment ? 'xxl' : false);// Before
@Input()
public rotation!: 0 | 90 | 180 | 270;
// After
public rotation = input.required<0 | 90 | 180 | 270>();Properties with custom setter logic that need to be converted to effect():
- formData - Updates form support service
- pageViewMode - Complex view mode handling with redraw
- scrollMode - Syncs with PDF viewer application
- enablePrintAutoRotate - Updates PDF viewer settings
- minifiedJSLibraries - Modifies pdfDefaultOptions
- src - Async blob/URL processing
- base64Src - Base64 decoding and loading
- height - Manages minHeight and autoHeight
- showSidebarButton - Responsive visibility with storage
- sidebarVisible - Emits change events
- showRotateButton - Sets both CW and CCW buttons
- handTool - iOS-specific handling
- showScrollingButtons - Sets 6 related properties
- page - Number/string conversion
- zoomLevels - Array manipulation
- mobileFriendlyZoom - Complex zoom calculation
Event emitters to be converted to output():
- annotationEditorEvent
- srcChange
- pageViewModeChange
- progress
- scrollModeChange
- currentZoomFactor
- rotationChange
- And 30 more...
View child queries to be converted to viewChild():
- dummyComponents
- root
- secondaryToolbarComponent
- dynamicCSSComponent
- sidebarComponent
The component will not compile after Phase 1. This is intentional and expected.
-
Setter assignment errors: Setters try to assign to readonly signals
// Error: Cannot assign to showRotateCwButton because it's an InputSignal public set showRotateButton(visibility: ResponsiveVisibility) { this.showRotateCwButton = visibility; // ← Error here this.showRotateCcwButton = visibility; // ← And here }
-
Interface compatibility errors:
// NgxHasHeight interface expects: minHeight: string // Component now has: minHeight: InputSignal<string | undefined>
-
Property access errors: Code that reads these properties needs to call them as functions
// Old way if (this.showBorders) { } // New way (will be fixed in Phase 2) if (this.showBorders()) { }
These errors will be systematically fixed in Phase 2 when:
- Setters are converted to
effect() - Property reads are updated to use the signal getter
() - Interfaces are updated to accept signals
/workspace/ngx-extended-pdf-viewer/projects/ngx-extended-pdf-viewer/src/lib/ngx-extended-pdf-viewer.component.ts- Line 11: Added
inputto imports - 89 properties converted from
@Input()decorator toinput()signal
- Line 11: Added
ngx-extended-pdf-viewer.component.ts.backup- Original file backupMIGRATION-PHASE-1-SUMMARY.md- Detailed summary with examplesMIGRATED-PROPERTIES-PHASE-1.md- Complete list of all 89 propertiesPHASE-1-COMPLETE.md- This file
| Metric | Count |
|---|---|
| Total decorators in file | 147 |
| @Input decorators before | 105 |
| @Input decorators migrated | 89 |
| @Input decorators remaining | 16 |
| @Output decorators | 37 |
| @ViewChild decorators | 5 |
| Lines in file | 2,701 |
| Migration success rate | 85% of @Input |
Run these commands to verify the migration:
# Count migrated input signals
grep -E "public \w+ = input" ngx-extended-pdf-viewer.component.ts | wc -l
# Expected: 89
# Count remaining @Input decorators
grep -c "^\s*@Input()" ngx-extended-pdf-viewer.component.ts
# Expected: 16
# Count @Output decorators
grep -c "^\s*@Output()" ngx-extended-pdf-viewer.component.ts
# Expected: 37
# Count @ViewChild decorators
grep -c "^\s*@ViewChild" ngx-extended-pdf-viewer.component.ts
# Expected: 5Convert @Input setters to input() + effect() pattern:
- Replace
@Input() set property(value)withpublic property = input<Type>(default) - Create
effect()to handle the setter logic - Update any direct assignments to use
.set()method
Convert @Output to output():
- Replace
@Output() public event = new EventEmitter<Type>()withpublic event = output<Type>() - Update emit() calls (no changes needed, API compatible)
Convert @ViewChild to viewChild():
- Replace
@ViewChild(Component) prop!: Componentwithpublic prop = viewChild.required<Component>() - Update property access to use
()for signal reading
- Remove unused decorator imports (Input, Output, ViewChild)
- Update ngOnChanges if it references migrated properties
- Run full test suite
- Update component documentation
The migration was performed using a Python script that:
- Identified all
@Input()decorators - Checked if the next line had a setter (skip if yes)
- Parsed the property declaration (name, type, default value)
- Generated the equivalent
input()signal declaration - Updated the file in-place with proper formatting
Script location: /tmp/migrate_component.py
If needed, restore the original file:
cp projects/ngx-extended-pdf-viewer/src/lib/ngx-extended-pdf-viewer.component.ts.backup \
projects/ngx-extended-pdf-viewer/src/lib/ngx-extended-pdf-viewer.component.tsPhase 1 Status: ✅ COMPLETE Phase 2 Status: ⏳ PENDING Phase 3 Status: ⏳ PENDING Phase 4 Status: ⏳ PENDING
Date: 2025-12-25 Component: ngx-extended-pdf-viewer.component.ts Total Properties Migrated: 89 / 147 (61%)