File
Metadata
| changeDetection |
ChangeDetectionStrategy.OnPush |
| host |
{ } |
| selector |
cx-update-password |
| templateUrl |
./update-password.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 { UpdatePasswordComponentService } from './update-password-component.service';
@Component({
selector: 'cx-update-password',
templateUrl: './update-password.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'user-form' },
})
export class UpdatePasswordComponent {
constructor(protected service: UpdatePasswordComponentService) {}
form: FormGroup = this.service.form;
isUpdating$ = this.service.isUpdating$;
onSubmit(): void {
this.service.updatePassword();
}
}
<cx-spinner class="overlay" *ngIf="isUpdating$ | async"> </cx-spinner>
<form (ngSubmit)="onSubmit()" [formGroup]="form">
<label>
<span class="label-content">{{
'updatePasswordForm.oldPassword.label' | cxTranslate
}}</span>
<input
aria-required="true"
class="form-control"
type="password"
name="oldPassword"
placeholder="{{
'updatePasswordForm.oldPassword.placeholder' | cxTranslate
}}"
formControlName="oldPassword"
/>
<cx-form-errors
aria-live="assertive"
aria-atomic="true"
[control]="form.get('oldPassword')"
></cx-form-errors>
</label>
<label>
<span class="label-content">{{
'updatePasswordForm.newPassword.label' | cxTranslate
}}</span>
<input
aria-required="true"
class="form-control"
type="password"
name="newPassword"
placeholder="{{
'updatePasswordForm.newPassword.placeholder' | cxTranslate
}}"
formControlName="newPassword"
/>
<cx-form-errors
aria-live="assertive"
aria-atomic="true"
[control]="form.get('newPassword')"
></cx-form-errors>
</label>
<label>
<span class="label-content">{{
'updatePasswordForm.confirmPassword.label' | cxTranslate
}}</span>
<input
aria-required="true"
class="form-control"
type="password"
name="newPasswordConfirm"
placeholder="{{
'updatePasswordForm.confirmPassword.placeholder' | cxTranslate
}}"
formControlName="newPasswordConfirm"
/>
<cx-form-errors
aria-live="assertive"
aria-atomic="true"
[control]="form.get('newPasswordConfirm')"
></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