- {{ title }}
+ {{ title | abpLocalization }}
- {{ details }}
+ {{ details | abpLocalization }}
diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/errors/validation-error.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/errors/validation-error.component.ts
new file mode 100644
index 0000000000..7590d74b91
--- /dev/null
+++ b/npm/ng-packs/packages/theme-shared/src/lib/components/errors/validation-error.component.ts
@@ -0,0 +1,32 @@
+import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
+import { Validation, ValidationErrorComponent as ErrorComponent } from '@ngx-validate/core';
+
+@Component({
+ selector: 'abp-validation-error',
+ template: `
+
+ {{ error.message | abpLocalization: error.interpoliteParams }}
+
+ `,
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ encapsulation: ViewEncapsulation.None,
+})
+export class ValidationErrorComponent extends ErrorComponent {
+ get abpErrors(): Validation.Error[] & { interpoliteParams?: string[] } {
+ return this.validationErrors.map(error => {
+ if (!error.message) return error;
+
+ const index = error.message.indexOf('[');
+
+ if (index > -1) {
+ return {
+ ...error,
+ message: error.message.slice(0, index),
+ interpoliteParams: error.message.slice(index + 1, error.message.length - 1).split(','),
+ };
+ }
+
+ return error;
+ });
+ }
+}
diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts
index 53eb6182f9..63a92ed075 100644
--- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts
+++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts
@@ -137,14 +137,16 @@ export class ModalComponent implements OnDestroy {
this.close();
});
- if (!this.abpClose) return;
-
- fromEvent(this.abpClose.nativeElement, 'click')
- .pipe(
- takeUntil(this.destroy$),
- filter(() => !!(this.closable && this.modalContent)),
- )
- .subscribe(() => this.close());
+ setTimeout(() => {
+ if (!this.abpClose) return;
+
+ fromEvent(this.abpClose.nativeElement, 'click')
+ .pipe(
+ takeUntil(this.destroy$),
+ filter(() => !!(this.closable && this.modalContent)),
+ )
+ .subscribe(() => this.close());
+ }, 0);
this.init.emit();
}
diff --git a/npm/ng-packs/packages/theme-shared/src/lib/contants/styles.ts b/npm/ng-packs/packages/theme-shared/src/lib/contants/styles.ts
index 12aeadabf5..2ccca53006 100644
--- a/npm/ng-packs/packages/theme-shared/src/lib/contants/styles.ts
+++ b/npm/ng-packs/packages/theme-shared/src/lib/contants/styles.ts
@@ -24,6 +24,10 @@ export default `
top: 18px;
}
+.navbar .dropdown-menu {
+ min-width: 220px;
+}
+
.modal {
background-color: rgba(0, 0, 0, .6);
}
diff --git a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts
index 9d1cfb9662..2604bcdaab 100644
--- a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts
+++ b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts
@@ -80,14 +80,14 @@ export class ErrorHandler {
case 500:
this.createErrorComponent({
title: '500',
- details: 'Sorry, an error has occured.',
+ details: 'AbpAccount::InternalServerErrorMessage',
});
break;
case 0:
if ((err as HttpErrorResponse).statusText === 'Unknown Error') {
this.createErrorComponent({
title: 'Unknown Error',
- details: 'Sorry, an error has occured.',
+ details: 'AbpAccount::InternalServerErrorMessage',
});
}
break;
diff --git a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts
index 1f7410677c..bf2b9e411a 100644
--- a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts
+++ b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts
@@ -14,6 +14,7 @@ import { ToastComponent } from './components/toast/toast.component';
import styles from './contants/styles';
import { ErrorHandler } from './handlers/error.handler';
import { ButtonComponent } from './components/button/button.component';
+import { ValidationErrorComponent } from './components/errors/validation-error.component';
export function appendScript(injector: Injector) {
const fn = function() {
@@ -40,6 +41,16 @@ export function appendScript(injector: Injector) {
NgbModalModule,
NgxValidateCoreModule.forRoot({
targetSelector: '.form-group',
+ blueprints: {
+ email: `AbpAccount::ThisFieldIsNotAValidEmailAddress.`,
+ max: `AbpAccount::ThisFieldMustBeAStringWithAMaximumLengthOf{1}[{{ max }}]`,
+ maxlength: `AbpAccount::ThisFieldMustBeAStringWithAMaximumLengthOf{1}[{{ requiredLength }}]`,
+ min: `AbpAccount::ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}[{{ min }},{{ max }}]`,
+ minlength: `AbpAccount::ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}[{{ min }},{{ max }}]`,
+ required: `AbpAccount::ThisFieldIsRequired.`,
+ passwordMismatch: `AbpIdentity::Identity.PasswordConfirmationFailed`,
+ },
+ errorTemplate: ValidationErrorComponent,
}),
],
declarations: [
@@ -49,9 +60,10 @@ export function appendScript(injector: Injector) {
ModalComponent,
ErrorComponent,
LoaderBarComponent,
+ ValidationErrorComponent,
],
exports: [NgbModalModule, ButtonComponent, ConfirmationComponent, ToastComponent, ModalComponent, LoaderBarComponent],
- entryComponents: [ErrorComponent],
+ entryComponents: [ErrorComponent, ValidationErrorComponent],
})
export class ThemeSharedModule {
static forRoot(): ModuleWithProviders {
diff --git a/templates/app/angular/src/app/app-routing.module.ts b/templates/app/angular/src/app/app-routing.module.ts
index a495abb761..9890f33136 100644
--- a/templates/app/angular/src/app/app-routing.module.ts
+++ b/templates/app/angular/src/app/app-routing.module.ts
@@ -6,9 +6,8 @@ import { ABP } from '@abp/ng.core';
import { TENANT_MANAGEMENT_ROUTES } from '@abp/ng.tenant-management';
const routes: Routes = [
- { path: '', redirectTo: '/home', pathMatch: 'full' },
{
- path: 'home',
+ path: '',
loadChildren: () => import('./home/home.module').then(m => m.HomeModule),
data: {
routes: {