- @if (selectedTab === 0) {
+ @if (selectedTab() === 0) {
}
- @if (selectedTab === 1) {
+ @if (selectedTab() === 1) {
}
diff --git a/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.ts b/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.ts
index 6daa273196c..4ce1b0e2285 100644
--- a/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.ts
+++ b/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.ts
@@ -1,8 +1,7 @@
import { ProfileService } from '@abp/ng.account.core/proxy';
import { LoadingDirective } from '@abp/ng.theme.shared';
-import { Component, inject, OnInit, signal } from '@angular/core';
+import { Component, inject, OnInit, signal, ChangeDetectionStrategy } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
-import { finalize } from 'rxjs/operators';
import { eAccountComponents } from '../../enums/components';
import { ManageProfileStateService } from '../../services/manage-profile.state.service';
import { ReactiveFormsModule } from '@angular/forms';
@@ -11,6 +10,7 @@ import { PersonalSettingsComponent } from '../personal-settings/personal-setting
import { ChangePasswordComponent } from '../change-password/change-password.component';
@Component({
+ changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-manage-profile',
templateUrl: './manage-profile.component.html',
styles: [
@@ -39,36 +39,29 @@ import { ChangePasswordComponent } from '../change-password/change-password.comp
ChangePasswordComponent,
LocalizationPipe,
ReplaceableTemplateDirective,
- LoadingDirective
+ LoadingDirective,
],
})
export class ManageProfileComponent implements OnInit {
protected profileService = inject(ProfileService);
protected manageProfileState = inject(ManageProfileStateService);
- selectedTab = 0;
+ readonly selectedTab = signal(0);
+ readonly hideChangePasswordTab = signal(false);
+
+ readonly profile = toSignal(this.manageProfileState.getProfile$());
changePasswordKey = eAccountComponents.ChangePassword;
personalSettingsKey = eAccountComponents.PersonalSettings;
- profile = toSignal(this.manageProfileState.getProfile$());
-
- profileLoading = signal(false);
-
- hideChangePasswordTab?: boolean;
-
ngOnInit() {
- this.profileLoading.set(true);
- this.profileService
- .get()
- .pipe(finalize(() => this.profileLoading.set(false)))
- .subscribe(profile => {
- this.manageProfileState.setProfile(profile);
- if (profile.isExternal) {
- this.hideChangePasswordTab = true;
- this.selectedTab = 1;
- }
- });
+ this.profileService.get().subscribe(profile => {
+ this.manageProfileState.setProfile(profile);
+ if (profile.isExternal) {
+ this.hideChangePasswordTab.set(true);
+ this.selectedTab.set(1);
+ }
+ });
}
}
diff --git a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings-half-row.component.ts b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings-half-row.component.ts
index be6287e954b..4e870b1820c 100644
--- a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings-half-row.component.ts
+++ b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings-half-row.component.ts
@@ -1,4 +1,4 @@
-import { Component, inject } from '@angular/core';
+import { Component, inject, ChangeDetectionStrategy } from '@angular/core';
import {
EXTENSIONS_FORM_PROP,
FormProp,
@@ -8,6 +8,7 @@ import { ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
import { LocalizationPipe } from '@abp/ng.core';
@Component({
+ changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-personal-settings-half-row',
template: `
diff --git a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.html b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.html
index e77bb8f0711..f141ea48976 100644
--- a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.html
+++ b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.html
@@ -1,14 +1,14 @@
@if (form) {
-
}
diff --git a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts
index 731c589ba0f..5019a6eab9b 100644
--- a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts
+++ b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts
@@ -5,8 +5,16 @@ import {
ConfirmationService,
ToasterService,
} from '@abp/ng.theme.shared';
-import { Component, inject, Injector, OnInit } from '@angular/core';
+import {
+ Component,
+ inject,
+ Injector,
+ OnInit,
+ signal,
+ ChangeDetectionStrategy,
+} from '@angular/core';
import { ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
+import { NgxValidateCoreModule } from '@ngx-validate/core';
import { finalize, filter } from 'rxjs/operators';
import { Account } from '../../models/account';
import { ManageProfileStateService } from '../../services/manage-profile.state.service';
@@ -19,9 +27,9 @@ import {
generateFormFromProps,
} from '@abp/ng.components/extensible';
import { eAccountComponents } from '../../enums';
-import { NgxValidateCoreModule } from '@ngx-validate/core';
@Component({
+ changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-personal-settings-form',
templateUrl: './personal-settings.component.html',
exportAs: 'abpPersonalSettingsForm',
@@ -61,7 +69,7 @@ export class PersonalSettingsComponent
form!: UntypedFormGroup;
- inProgress?: boolean;
+ readonly inProgress = signal(false);
buildForm() {
this.selected = this.manageProfileState.getProfile();
@@ -80,10 +88,10 @@ export class PersonalSettingsComponent
if (this.form.invalid) return;
const isLogOutConfirmMessageVisible = this.isLogoutConfirmMessageActive();
const isRefreshTokenExists = this.authService.getRefreshToken();
- this.inProgress = true;
+ this.inProgress.set(true);
this.profileService
.update(this.form.value)
- .pipe(finalize(() => (this.inProgress = false)))
+ .pipe(finalize(() => this.inProgress.set(false)))
.subscribe(profile => {
this.manageProfileState.setProfile(profile);
this.configState.refreshAppState();
diff --git a/npm/ng-packs/packages/account/src/lib/components/register/register.component.html b/npm/ng-packs/packages/account/src/lib/components/register/register.component.html
index efea7c2bcfd..730e46122c0 100644
--- a/npm/ng-packs/packages/account/src/lib/components/register/register.component.html
+++ b/npm/ng-packs/packages/account/src/lib/components/register/register.component.html
@@ -6,12 +6,7 @@
{{ 'AbpAccount::Register' | abpLocalization }}
}}
@if (isSelfRegistrationEnabled) {
-
+ }
} @else {
{{ 'AbpAccount::YourPasswordIsSuccessfullyReset' | abpLocalization }}
diff --git a/npm/ng-packs/packages/account/src/lib/components/reset-password/reset-password.component.ts b/npm/ng-packs/packages/account/src/lib/components/reset-password/reset-password.component.ts
index f4567c48bbf..25879ac6530 100644
--- a/npm/ng-packs/packages/account/src/lib/components/reset-password/reset-password.component.ts
+++ b/npm/ng-packs/packages/account/src/lib/components/reset-password/reset-password.component.ts
@@ -1,6 +1,14 @@
import { AccountService } from '@abp/ng.account.core/proxy';
import { ButtonComponent, getPasswordValidators } from '@abp/ng.theme.shared';
-import { Component, Injector, OnInit, inject } from '@angular/core';
+import {
+ Component,
+ effect,
+ Injector,
+ inject,
+ signal,
+ ChangeDetectionStrategy,
+} from '@angular/core';
+import { toSignal } from '@angular/core/rxjs-interop';
import {
ReactiveFormsModule,
UntypedFormBuilder,
@@ -15,6 +23,7 @@ import { LocalizationPipe } from '@abp/ng.core';
const PASSWORD_FIELDS = ['password', 'confirmPassword'];
@Component({
+ changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-reset-password',
templateUrl: './reset-password.component.html',
imports: [
@@ -25,18 +34,19 @@ const PASSWORD_FIELDS = ['password', 'confirmPassword'];
ButtonComponent,
],
})
-export class ResetPasswordComponent implements OnInit {
+export class ResetPasswordComponent {
private fb = inject(UntypedFormBuilder);
private accountService = inject(AccountService);
private route = inject(ActivatedRoute);
private router = inject(Router);
private injector = inject(Injector);
- form!: UntypedFormGroup;
+ private readonly queryParams = toSignal(this.route.queryParams);
- inProgress = false;
+ form!: UntypedFormGroup;
- isPasswordReset = false;
+ readonly inProgress = signal(false);
+ readonly isPasswordReset = signal(false);
mapErrorsFn: Validation.MapErrorsFn = (errors, groupErrors, control) => {
if (PASSWORD_FIELDS.indexOf(String(control?.name)) < 0) return errors;
@@ -44,9 +54,16 @@ export class ResetPasswordComponent implements OnInit {
return errors.concat(groupErrors.filter(({ key }) => key === 'passwordMismatch'));
};
- ngOnInit(): void {
- this.route.queryParams.subscribe(({ userId, resetToken }) => {
- if (!userId || !resetToken) this.router.navigateByUrl('/account/login');
+ constructor() {
+ effect(() => {
+ const params = this.queryParams();
+ if (!params) return;
+
+ const { userId, resetToken } = params;
+ if (!userId || !resetToken) {
+ void this.router.navigateByUrl('/account/login');
+ return;
+ }
this.form = this.fb.group(
{
@@ -63,9 +80,9 @@ export class ResetPasswordComponent implements OnInit {
}
onSubmit() {
- if (this.form.invalid || this.inProgress) return;
+ if (this.form.invalid || this.inProgress()) return;
- this.inProgress = true;
+ this.inProgress.set(true);
this.accountService
.resetPassword({
@@ -73,9 +90,9 @@ export class ResetPasswordComponent implements OnInit {
resetToken: this.form.get('resetToken')?.value,
password: this.form.get('password')?.value,
})
- .pipe(finalize(() => (this.inProgress = false)))
+ .pipe(finalize(() => this.inProgress.set(false)))
.subscribe(() => {
- this.isPasswordReset = true;
+ this.isPasswordReset.set(true);
});
}
}
diff --git a/npm/ng-packs/packages/cms-kit/admin/src/components/blog-posts/blog-post-form/blog-post-form.component.html b/npm/ng-packs/packages/cms-kit/admin/src/components/blog-posts/blog-post-form/blog-post-form.component.html
index 2f8a80d7215..fc8048fd413 100644
--- a/npm/ng-packs/packages/cms-kit/admin/src/components/blog-posts/blog-post-form/blog-post-form.component.html
+++ b/npm/ng-packs/packages/cms-kit/admin/src/components/blog-posts/blog-post-form/blog-post-form.component.html
@@ -1,13 +1,13 @@
- @if (form && (!isEditMode || blogPost)) {
-