diff --git a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html
index 967bc21ba..f5be10ed4 100644
--- a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html
+++ b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html
@@ -258,7 +258,7 @@
[ngClass]="{
'disabled-select-notifications-email': hasOneEmailAddress()
}"
- placeholder=" {{ primaryEmail.value }}"
+ placeholder=" {{ primaryEmail?.value }}"
[(value)]="primaryEmail"
class="select-notifications-email orc-font-body-small"
>
@@ -266,7 +266,8 @@
diff --git a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.spec.ts b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.spec.ts
index 12a069e69..00e7ca837 100644
--- a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.spec.ts
+++ b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.spec.ts
@@ -4,7 +4,6 @@ import { ModalEmailComponent } from './modal-email.component'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { RouterTestingModule } from '@angular/router/testing'
import { WINDOW_PROVIDERS } from '../../../window'
-import { RegisterService } from '../../../../core/register/register.service'
import { PlatformInfoService } from '../../../platform-info'
import { ErrorHandlerService } from '../../../../core/error-handler/error-handler.service'
import { SnackbarService } from '../../../snackbar/snackbar.service'
@@ -15,6 +14,7 @@ import {
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog'
import { Overlay } from '@angular/cdk/overlay'
+import { AlertMessageModule } from 'src/app/cdk/alert-message/alert-message.module'
describe('ModalEmailComponent', () => {
let component: ModalEmailComponent
@@ -22,7 +22,11 @@ describe('ModalEmailComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [HttpClientTestingModule, RouterTestingModule],
+ imports: [
+ HttpClientTestingModule,
+ RouterTestingModule,
+ AlertMessageModule,
+ ],
declarations: [ModalEmailComponent],
providers: [
{ provide: MAT_DIALOG_DATA, useValue: {} },
diff --git a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts
index 89df1be13..6f25d9704 100644
--- a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts
+++ b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts
@@ -70,7 +70,7 @@ export class ModalEmailComponent implements OnInit, OnDestroy {
addedEmailsCount = 0
emailsForm: UntypedFormGroup = new UntypedFormGroup({})
emails: AssertionVisibilityString[] = []
- primaryEmail: AssertionVisibilityString
+ primaryEmail: AssertionVisibilityString | undefined = undefined
originalEmailsBackendCopy: AssertionVisibilityString[]
defaultVisibility: VisibilityStrings = 'PRIVATE'
@@ -399,7 +399,7 @@ export class ModalEmailComponent implements OnInit, OnDestroy {
deleteEmail(controlKey: string) {
if (!this.hasOneEmailAddress(controlKey)) {
- if (controlKey === this.primaryEmail.putCode) {
+ if (controlKey === this.primaryEmail?.putCode) {
this.setNextEmailAsPrimary()
}