Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
2805027
Use inject() for LibraryComponent
hirokiterashima Nov 14, 2025
8208d7e
Use inject() for constraint authoring
hirokiterashima Nov 18, 2025
fee8158
Use inject() for ComponentStudent and all its children components
hirokiterashima Nov 18, 2025
367de5f
Merge branch 'develop' into use-inject-instead-of-constructor
hirokiterashima Dec 4, 2025
c610e8c
Use inject() for EditConnectedComponents and all its children components
hirokiterashima Dec 4, 2025
addc093
Use inject() for AbstractComponentAuthoring and all its children comp…
hirokiterashima Dec 5, 2025
00f92fd
Use inject() for ChooseNodeLocation and all its children components
hirokiterashima Dec 5, 2025
fc98fb1
Use inject() for ComponentService and all its children classes
hirokiterashima Dec 5, 2025
b28a5ca
Use inject() for ShareItemDialogComponent and all its children classes
hirokiterashima Dec 5, 2025
b08950e
Use inject() for AbstractTagsMenu and all its children classes
hirokiterashima Dec 5, 2025
0269953
Use inject() for ComponentShowWorkDirective and all its children classes
hirokiterashima Dec 5, 2025
06b42fa
Use inject() for AuthorBranchService and all its children classes
hirokiterashima Dec 5, 2025
1390e0d
Use inject() for WiseTinymceEditorComponent and its child classes
hirokiterashima Dec 7, 2025
145939f
Use inject() for RegisterUserForm and its child classes
hirokiterashima Dec 7, 2025
8cbfd76
Use inject() for Notebook classes
hirokiterashima Dec 7, 2025
9cbd095
Use inject() for AbstractBranchAuthoring class and its child classes
hirokiterashima Dec 7, 2025
960c3cc
Use inject() for AbstractTranslatableFieldComponent and its child cla…
hirokiterashima Dec 7, 2025
e60a858
Merge branch 'develop' into use-inject-instead-of-constructor
hirokiterashima Dec 11, 2025
d6c149b
Use inject() for EditProfileComponent and its child classes
hirokiterashima Dec 11, 2025
db9d67f
Use inject() for NodeService and its child classes
hirokiterashima Dec 12, 2025
e6eb461
Use inject() for ProjectTranslationService and its child classes
hirokiterashima Dec 12, 2025
0464462
Use inject() for AuthorPeerGroupingDialogComponent and its child classes
hirokiterashima Dec 12, 2025
1a7ddb6
Use inject() for ProjectService and its child classes. Need to update…
hirokiterashima Dec 12, 2025
5c58caa
Use inject() for AbstractClassResponsesComponent and its child classes
hirokiterashima Dec 12, 2025
889bb3c
Use inject() for DataService and its child classes
hirokiterashima Dec 12, 2025
68d02a6
Use inject() for NotificationService and its child classes
hirokiterashima Dec 18, 2025
a538f76
Use inject() for PeerGroupService and its child classes
hirokiterashima Dec 18, 2025
aa22eda
Use inject() for StepToolsComponent and its child classes
hirokiterashima Dec 18, 2025
d36fb1e
Replace constructor with inject() in StepToolsComponent
hirokiterashima Dec 18, 2025
5a905b3
Use inject() for AbstractExportComponent and its child classes
hirokiterashima Dec 19, 2025
5b9d417
Use inject() for DiscourseFeedComponent and its child classes
hirokiterashima Dec 22, 2025
47c1692
Use inject() for ExportController and its child classes
hirokiterashima Dec 22, 2025
b6a85d0
Use inject() for EditComponentFieldComponent
hirokiterashima Jan 6, 2026
d8f3456
Use inject() for ChooseNewComponent, EditComponentJsonComponent, Edit…
hirokiterashima Jan 6, 2026
412745a
Use inject() for components in src/app/student
hirokiterashima Jan 6, 2026
3fa4109
Use inject() for components in src/app/authoring-tool
hirokiterashima Jan 6, 2026
5b48b15
Use inject() for ProjectLanguageChooserComponent
hirokiterashima Jan 6, 2026
82e4584
Use inject() for components in src/app/forgot
hirokiterashima Jan 6, 2026
0352f4a
Use inject() for CurriculumComponent
hirokiterashima Jan 6, 2026
d173d8a
Use inject() for LoginHomeComponent
hirokiterashima Jan 6, 2026
ad663de
Use inject() for components in src/app/modules
hirokiterashima Jan 6, 2026
dbb1c0f
Use inject() for components in src/app/register
hirokiterashima Jan 6, 2026
03e212c
Use inject() for components in src/assets/wise5/authoringTool
hirokiterashima Jan 6, 2026
667786b
Use inject() for components in src/app/teacher
hirokiterashima Jan 6, 2026
d9dfc5c
Use inject() for components in src/assets/wise5/classroomMonitor/clas…
hirokiterashima Jan 6, 2026
5c09a86
Use inject() for HomeComponent
hirokiterashima Jan 7, 2026
8ad7448
Use inject() for AnnouncementComponent
hirokiterashima Jan 7, 2026
a002ff0
Use inject() for ContactFormComponent
hirokiterashima Jan 7, 2026
57a00f1
Use inject() for classes in src/app/services
hirokiterashima Jan 7, 2026
3b24243
Use inject() for ChooseBranchPathDialogComponent
hirokiterashima Jan 7, 2026
9060e5f
Use inject() for NewsComponent
hirokiterashima Jan 7, 2026
b605b78
Use inject() for abstract classes in src/app/register
hirokiterashima Jan 7, 2026
5e62c55
Use inject() for PossibleScoreComponent
hirokiterashima Jan 7, 2026
999ea44
Use inject() for ConfigureStructureComponent
hirokiterashima Jan 7, 2026
db088d9
Use inject() for classes in src/assets/wise5/classroomMonitor/classro…
hirokiterashima Jan 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 5 additions & 7 deletions src/app/announcement/announcement.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, Output, ViewEncapsulation, Inject } from '@angular/core';
import { Component, EventEmitter, Input, Output, ViewEncapsulation, inject } from '@angular/core';
import { Announcement } from '../domain/announcement';
import {
MatDialogRef,
Expand All @@ -22,11 +22,11 @@ import { CdkScrollable } from '@angular/cdk/scrolling';
templateUrl: './announcement.component.html'
})
export class AnnouncementComponent {
dialog = inject(MatDialog);

@Input() announcement: Announcement = new Announcement();
@Output() dismiss: EventEmitter<void> = new EventEmitter<void>();

constructor(public dialog: MatDialog) {}

protected showAnnouncementDetails(): void {
this.dialog.open(AnnouncementDialogComponent, {
data: this.announcement,
Expand All @@ -48,8 +48,6 @@ export class AnnouncementComponent {
templateUrl: 'announcement-dialog.component.html'
})
export class AnnouncementDialogComponent {
constructor(
public dialogRef: MatDialogRef<AnnouncementDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: Announcement
) {}
dialogRef = inject<MatDialogRef<AnnouncementDialogComponent>>(MatDialogRef);
data = inject<Announcement>(MAT_DIALOG_DATA);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, inject } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { ComponentTypeButtonComponent } from '../../../../assets/wise5/authoringTool/components/component-type-button/component-type-button.component';
Expand All @@ -10,12 +10,10 @@ import { ComponentTypeService } from '../../../../assets/wise5/services/componen
templateUrl: 'choose-new-component.component.html'
})
export class ChooseNewComponent {
protected componentTypes: any[];
private componentTypeService = inject(ComponentTypeService);
private dialogRef = inject(MatDialogRef<ChooseNewComponent>);

constructor(
private componentTypeService: ComponentTypeService,
private dialogRef: MatDialogRef<ChooseNewComponent>
) {}
protected componentTypes: any[];

ngOnInit(): void {
this.componentTypes = this.componentTypeService.getComponentTypes();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Directive, Input } from '@angular/core';
import { Directive, inject, Input } from '@angular/core';
import { ComponentContent } from '../../../assets/wise5/common/ComponentContent';
import { Component } from '../../../assets/wise5/common/Component';
import { NotebookService } from '../../../assets/wise5/services/notebookService';
Expand All @@ -8,17 +8,15 @@ import { moveObjectDown, moveObjectUp } from '../../../assets/wise5/common/array

@Directive()
export abstract class EditAdvancedComponentComponent {
protected nodeService = inject(TeacherNodeService);
protected notebookService = inject(NotebookService);
protected teacherProjectService = inject(TeacherProjectService);

component: Component;
componentContent: ComponentContent;
@Input() componentId: string;
@Input() nodeId: string;

constructor(
protected nodeService: TeacherNodeService,
protected notebookService: NotebookService,
protected teacherProjectService: TeacherProjectService
) {}

ngOnInit(): void {
this.componentContent = this.teacherProjectService.getComponent(this.nodeId, this.componentId);
this.component = new Component(this.componentContent, this.nodeId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, Input, inject } from '@angular/core';
import { Subject, Subscription } from 'rxjs';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { TeacherProjectService } from '../../../../assets/wise5/services/teacherProjectService';
Expand All @@ -24,12 +24,12 @@ import { MatFormFieldModule } from '@angular/material/form-field';
templateUrl: 'edit-component-default-feedback.component.html'
})
export class EditComponentDefaultFeedback {
private projectService = inject(TeacherProjectService);

@Input() componentContent: any;
protected feedbackChanged: Subject<string> = new Subject<string>();
private feedbackChangedSubscription: Subscription;

constructor(private projectService: TeacherProjectService) {}

ngOnInit(): void {
this.feedbackChangedSubscription = this.feedbackChanged
.pipe(debounceTime(1000), distinctUntilChanged())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, Input, inject } from '@angular/core';
import { Component as WISEComponent } from '../../../assets/wise5/common/Component';
import { TeacherProjectService } from '../../../assets/wise5/services/teacherProjectService';
import { EditConnectedComponentsComponent } from '../edit-connected-components/edit-connected-components.component';
Expand Down Expand Up @@ -33,11 +33,11 @@ import { EditComponentConstraintsComponent } from '../edit-component-constraints
templateUrl: './edit-common-advanced.component.html'
})
export class EditCommonAdvancedComponent {
protected projectService = inject(TeacherProjectService);

@Input() allowedConnectedComponentTypes: string[] = [];
@Input() component: WISEComponent;

constructor(protected projectService: TeacherProjectService) {}

protected connectedComponentsChanged(connectedComponents: any[]): void {
this.component.content.connectedComponents = connectedComponents;
this.projectService.nodeChanged();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
createComponent,
ElementRef,
EnvironmentInjector,
Inject,
ViewChild
ViewChild,
inject
} from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
Expand All @@ -22,13 +22,12 @@ import { components } from '../../../assets/wise5/components/Components';
templateUrl: './edit-component-advanced.component.html'
})
export class EditComponentAdvancedComponent {
private applicationRef = inject(ApplicationRef);
protected component = inject<WISEComponent>(MAT_DIALOG_DATA);
private injector = inject(EnvironmentInjector);

@ViewChild('component') private componentElementRef: ElementRef;
private componentRef: ComponentRef<WISEComponent>;
constructor(
private applicationRef: ApplicationRef,
@Inject(MAT_DIALOG_DATA) protected component: WISEComponent,
private injector: EnvironmentInjector
) {}

ngAfterViewInit(): void {
this.componentRef = createComponent(components[this.component.content.type].authoringAdvanced, {
Expand Down
6 changes: 3 additions & 3 deletions src/app/authoring-tool/edit-component-field.component.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Directive, Input } from '@angular/core';
import { Directive, inject, Input } from '@angular/core';
import { Subject, Subscription } from 'rxjs';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { TeacherProjectService } from '../../assets/wise5/services/teacherProjectService';

@Directive()
export abstract class EditComponentFieldComponent {
private projectService = inject(TeacherProjectService);

@Input() componentContent: any;
protected inputChanged: Subject<any> = new Subject<any>();
protected inputChangedSubscription: Subscription;

constructor(private projectService: TeacherProjectService) {}

ngOnInit(): void {
this.inputChangedSubscription = this.inputChanged
.pipe(debounceTime(1000), distinctUntilChanged())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, inject, Input } from '@angular/core';
import { Subject, Subscription } from 'rxjs';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { NotificationService } from '../../../assets/wise5/services/notificationService';
Expand Down Expand Up @@ -27,18 +27,16 @@ import { MatButtonModule } from '@angular/material/button';
templateUrl: 'edit-component-json.component.html'
})
export class EditComponentJsonComponent {
private notificationService = inject(NotificationService);
private projectService = inject(TeacherProjectService);

@Input() component: WISEComponent;
protected componentContentJSONString: string;
protected jsonChanged: Subject<string> = new Subject<string>();
protected showJSONAuthoring: boolean = false;
private subscriptions: Subscription = new Subscription();
private validComponentContentJSONString: string;

constructor(
private notificationService: NotificationService,
private projectService: TeacherProjectService
) {}

ngOnInit(): void {
this.setComponentContentJsonString();
this.subscriptions.add(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, Input, inject } from '@angular/core';
import { TeacherProjectService } from '../../../assets/wise5/services/teacherProjectService';
import { SelectPeerGroupingAuthoringComponent } from '../../../assets/wise5/authoringTool/peer-grouping/select-peer-grouping-authoring/select-peer-grouping-authoring.component';

Expand All @@ -11,9 +11,9 @@ import { SelectPeerGroupingAuthoringComponent } from '../../../assets/wise5/auth
/>`
})
export class EditComponentPeerGroupingTagComponent {
@Input() componentContent: any;
private projectService = inject(TeacherProjectService);

constructor(private projectService: TeacherProjectService) {}
@Input() componentContent: any;

peerGroupingTagChanged(tag: string): void {
this.componentContent.peerGroupingTag = tag;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, Input, inject } from '@angular/core';
import { TeacherProjectService } from '../../../assets/wise5/services/teacherProjectService';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
Expand All @@ -21,11 +21,11 @@ import { MatFormFieldModule } from '@angular/material/form-field';
templateUrl: 'edit-component-rubric.component.html'
})
export class EditComponentRubricComponent {
private projectService = inject(TeacherProjectService);

@Input() componentContent: any;
protected showRubricAuthoring: boolean;

constructor(private projectService: TeacherProjectService) {}

protected save(): void {
this.projectService.componentChanged();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, Input, inject } from '@angular/core';
import { Subject, Subscription } from 'rxjs';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { TeacherProjectService } from '../../../assets/wise5/services/teacherProjectService';
Expand Down Expand Up @@ -36,12 +36,12 @@ import { MatFormFieldModule } from '@angular/material/form-field';
templateUrl: 'edit-component-tags.component.html'
})
export class EditComponentTagsComponent {
private projectService = inject(TeacherProjectService);

@Input() componentContent: any;
protected tagChanged: Subject<any> = new Subject<any>();
private tagChangedSubscription: Subscription;

constructor(private projectService: TeacherProjectService) {}

ngOnInit(): void {
this.tagChangedSubscription = this.tagChanged
.pipe(debounceTime(1000), distinctUntilChanged())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { Component } from '@angular/core';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { EditConnectedComponentsComponent } from '../edit-connected-components/edit-connected-components.component';

@Component({
template: ''
})
@Component({ template: ''}) // this class needs to be a component to extends parent class and be used as a base class
export class EditConnectedComponentsWithBackgroundComponent extends EditConnectedComponentsComponent {
componentTypesThatCanImportWorkAsBackground: string[] = [];

constructor(protected projectService: ProjectService) {
super(projectService);
}

canConnectedComponentTypeImportWorkAsBackground(connectedComponent: any): boolean {
return this.componentTypesThatCanImportWorkAsBackground.includes(
this.getConnectedComponentType(connectedComponent)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { EditConnectedComponentsAddButtonComponent } from '../edit-connected-components-add-button/edit-connected-components-add-button.component';
import { EditConnectedComponentDefaultSelectsComponent } from '../edit-connected-component-default-selects/edit-connected-component-default-selects.component';
Expand All @@ -22,8 +22,7 @@ export class EditConnectedComponentsComponent implements OnInit {
@Input() connectedComponents: any[] = [];
@Output() connectedComponentsChanged: EventEmitter<any> = new EventEmitter();
nodeIds: string[];

constructor(protected projectService: ProjectService) {}
protected projectService: ProjectService = inject(ProjectService);

ngOnInit(): void {
if (this.connectedComponents == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input, OnInit, inject } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox';
import { MatFormFieldModule } from '@angular/material/form-field';
Expand Down Expand Up @@ -27,13 +27,13 @@ import { SelectStepAndComponentComponent } from '../select-step-and-component/se
templateUrl: './edit-question-bank.component.html'
})
export class EditQuestionBankComponent implements OnInit {
private projectService = inject(TeacherProjectService);

protected allowedReferenceComponentTypes: string[] = ['MultipleChoice', 'OpenResponse'];
@Input() componentContent: any;
protected inputChanged: Subject<string> = new Subject<string>();
private subscriptions: Subscription = new Subscription();

constructor(private projectService: TeacherProjectService) {}

ngOnInit(): void {
this.subscriptions.add(
this.inputChanged.pipe(debounceTime(1000), distinctUntilChanged()).subscribe(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { Component, inject } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatDividerModule } from '@angular/material/divider';
import { MatTabsModule } from '@angular/material/tabs';
Expand All @@ -16,19 +16,17 @@ import { AddStepTarget } from '../../../domain/addStepTarget';
templateUrl: './choose-import-unit.component.html'
})
export class ChooseImportUnitComponent {
private configService = inject(ConfigService);
private projectLibraryService = inject(ProjectLibraryService);
private route = inject(ActivatedRoute);
private router = inject(Router);

protected importType: 'step' | 'component';
protected libraryProjects: any[];
protected myProjects: any[];
private subscriptions: Subscription = new Subscription();
protected target: AddStepTarget;

constructor(
private configService: ConfigService,
private projectLibraryService: ProjectLibraryService,
private route: ActivatedRoute,
private router: Router
) {}

ngOnInit(): void {
this.importType = history.state.importType;
this.target = history.state;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, Output, SimpleChanges } from '@angular/core';
import { Component, EventEmitter, Input, Output, SimpleChanges, inject } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
Expand All @@ -11,6 +11,8 @@ import { ComponentContent } from '../../../assets/wise5/common/ComponentContent'
templateUrl: './select-component.component.html'
})
export class SelectComponentComponent {
private projectService = inject(ProjectService);

@Input() allowedComponentTypes: string[] = [];
@Output() componentChangedEvent: EventEmitter<string> = new EventEmitter<string>();
@Input() componentId: string;
Expand All @@ -19,8 +21,6 @@ export class SelectComponentComponent {
@Input() nodeId: string;
@Input() thisComponentId: string;

constructor(private projectService: ProjectService) {}

ngOnChanges(changes: SimpleChanges): void {
if (changes.nodeId) {
this.nodeId = changes.nodeId.currentValue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output, inject } from '@angular/core';
import { ReferenceComponent } from '../../domain/referenceComponent';
import { SelectStepComponent } from '../select-step/select-step.component';
import { SelectComponentComponent } from '../select-component/select-component.component';
Expand All @@ -20,14 +20,14 @@ import { SelectComponentComponent } from '../select-component/select-component.c
/>`
})
export class SelectStepAndComponentComponent {
private changeDetector = inject(ChangeDetectorRef);

@Input() allowedComponentTypes: string[] = [];
@Output() componentChange: EventEmitter<ReferenceComponent> = new EventEmitter();
@Input() referenceComponent: ReferenceComponent;
@Output() stepChange: EventEmitter<ReferenceComponent> = new EventEmitter();
@Input() thisComponentId: string;

constructor(private changeDetector: ChangeDetectorRef) {}

protected stepChanged(nodeId: string): void {
this.referenceComponent.nodeId = nodeId;
this.changeDetector.detectChanges();
Expand Down
Loading
Loading