File
Metadata
| changeDetection |
ChangeDetectionStrategy.OnPush |
| host |
{ } |
| selector |
cx-update-email |
| templateUrl |
./update-email.component.html |
|
form
|
Type : FormGroup
|
Default value : this.service.form
|
|
|
|
isUpdating$
|
Default value : this.service.isUpdating$
|
|
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { UpdateEmailComponentService } from './update-email-component.service';
@Component({
selector: 'cx-update-email',
templateUrl: './update-email.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'user-form' },
})
export class UpdateEmailComponent {
constructor(protected service: UpdateEmailComponentService) {}
form: FormGroup = this.service.form;
isUpdating$ = this.service.isUpdating$;
onSubmit(): void {
this.service.save();
}
}
<cx-spinner class="overlay" *ngIf="isUpdating$ | async"> </cx-spinner>
<form (ngSubmit)="onSubmit()" [formGroup]="form">
<label>
<span class="label-content">{{
'updateEmailForm.newEmailAddress.label' | cxTranslate
}}</span>
<input
aria-required="true"
type="email"
name="email"
formControlName="email"
placeholder="{{
'updateEmailForm.newEmailAddress.placeholder' | cxTranslate
}}"
class="form-control"
/>
<cx-form-errors
aria-live="assertive"
aria-atomic="true"
[control]="form.get('email')"
></cx-form-errors>
</label>
<label>
<span class="label-content">{{
'updateEmailForm.confirmNewEmailAddress.label' | cxTranslate
}}</span>
<input
aria-required="true"
type="email"
name="confirmEmail"
formControlName="confirmEmail"
placeholder="{{
'updateEmailForm.confirmNewEmailAddress.placeholder' | cxTranslate
}}"
class="form-control"
/>
<cx-form-errors
aria-live="assertive"
aria-atomic="true"
[control]="form.get('confirmEmail')"
></cx-form-errors>
</label>
<label>
<span class="label-content">{{
'updateEmailForm.password.label' | cxTranslate
}}</span>
<input
aria-required="true"
type="password"
name="password"
formControlName="password"
placeholder="{{ 'updateEmailForm.password.placeholder' | cxTranslate }}"
class="form-control"
autocomplete="new-password"
/>
<cx-form-errors
aria-live="assertive"
aria-atomic="true"
[control]="form.get('password')"
></cx-form-errors>
</label>
<a
class="btn btn-block btn-secondary"
[routerLink]="{ cxRoute: 'home' } | cxUrl"
>
{{ 'common.cancel' | cxTranslate }}
</a>
<button class="btn btn-block btn-primary" [disabled]="form.disabled">
{{ 'common.save' | cxTranslate }}
</button>
</form>
Legend
Html element with directive