Angular version 8.2
Hi, <span class="colour" style="color: rgb(34, 34, 34);">We are facing an issue in our date picker that shows "invalid date" as well as getting previous day date when we set date to field, we tried many option which found in support, but still we couldn't solve the problem. need a help to move on.</span> We need to set date format as "dd/mm/yyyy" in though out the app regardless of culture. but we cannot set <span class="colour" style="color: rgb(34, 34, 34);">ClockProviders.Local as the users will be from different countries and need to keep UTC.</span> Tried with adding new language as en-GB to get this date format also tried in ngx-bootstrap-datepicker-config.service.ts, but no luck. <span class="colour" style="color: rgb(34, 34, 34);">While we are saving the date, below format will come </span> <span class="colour" style="color: rgb(34, 34, 34);">When we set the value while edit form</span> <span class="colour" style="color: rgb(34, 34, 34);">I changed language to English GB to get date format as 'dd/mm/yyyy'. but format is not changing.</span>
As requested, ngx-bootstrap-datepicker-config.service.ts<span class="colour" style="color: rgb(34, 34, 34);"> code is below:</span>
static getDaterangepickerConfig(): BsDaterangepickerConfig {
return Object.assign(new BsDaterangepickerConfig(), {
containerClass: 'theme-' + NgxBootstrapDatePickerConfigService.getTheme()
});
}
static getDatepickerConfig(): BsDatepickerConfig {
return Object.assign(new BsDatepickerConfig(), {
containerClass: 'theme-' + NgxBootstrapDatePickerConfigService.getTheme()
});
}
static getTheme(): string {
return ThemeHelper.getTheme();
}
static getDatepickerLocale(): BsLocaleService {
let localeService = new BsLocaleService();
localeService.use(abp.localization.currentLanguage.name);
//localeService.use('en-GB');
return localeService;
}
static registerNgxBootstrapDatePickerLocales(): Promise<boolean> {
if (abp.localization.currentLanguage.name === 'en') {
return Promise.resolve(true);
}
let supportedLocale = new NgxBootstrapLocaleMappingService().map(abp.localization.currentLanguage.name).toLowerCase();
let moduleLocaleName = new NgxBootstrapLocaleMappingService().getModuleName(abp.localization.currentLanguage.name);
return new Promise<boolean>((resolve, reject) => {
import(ngx-bootstrap/chronos/esm5/i18n/${supportedLocale}.js)
.then(module => {
defineLocale(abp.localization.currentLanguage.name.toLowerCase(), module[${moduleLocaleName}Locale]);
resolve(true);
}, reject);
});
}
<br> Thanks.
Dear @ismcagdas,
Yes i checked this, we didn't do any changes in this classes, actual name was:
Please advice. Thanks.
Hello,
Getting an error while loading or sign in the application related to TokenAuth.
ERROR 2019-09-14 23:35:40,694 [75 ] Mvc.ExceptionHandling.AbpExceptionFilter - Can't create component '*.Web.Controllers.TokenAuthController' as it has dependencies to be satisfied.
'*.Web.Controllers.TokenAuthController' is waiting for the following dependencies:
- Service '*.Web.Authentication.JwtBearer.IProjectJwtSecurityStampHandler' which was not registered.
Castle.MicroKernel.Handlers.HandlerException: Can't create component '*.Web.Controllers.TokenAuthController' as it has dependencies to be satisfied.
'*.Web.Controllers.TokenAuthController' is waiting for the following dependencies:
- Service '*.Web.Authentication.JwtBearer.IProjectJwtSecurityStampHandler' which was not registered.
at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency()
at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext)
at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext)
at Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments)
at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) in D:\Github\castle-windsor-ms-adapter\src\Castle.Windsor.MsDependencyInjection\ScopedWindsorServiceProvider.cs:line 55
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
Any specific reason for this?. Thanks.
Hello, Getting error wile running the application, there is already one discussion is going on similar to this, tried those steps, but didn't worked. Also tried upgrading to newer version 7.1 to overcome this, but still we are facing the same. Tried downgrading of angular version to 8.0.1 but not able clear the issue.
Unhandled Promise rejection: Cannot read property 'toLowerCase' of undefined ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'toLowerCase' of undefined
at setLocaleId (core.js:23665)
at core.js:27268
at ZoneDelegate.push../node_modules/
zone.js/dist/zone.js.ZoneDelegate.invoke
(zone.js:391)
at Object.onInvoke (core.js:26769)
at ZoneDelegate.push../node_modules/
zone.js/dist/zone.js.ZoneDelegate.invoke
(zone.js:390)
at Zone.push../node_modules/
zone.js/dist/zone.js.Zone.run
(zone.js:150)
at NgZone.push../node_modules/@angular/core/fesm5/core.js.NgZone.run (core.js:26683)
at PlatformRef.push../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModuleFactory (core.js:27259)
at core.js:27302
at ZoneDelegate.push../node_modules/
zone.js/dist/zone.js.ZoneDelegate.invoke
(zone.js:391) TypeError: Cannot read property 'toLowerCase' of undefined
at setLocaleId (
http://localhost:4200/vendor.js:71000:26
)
at
http://localhost:4200/vendor.js:74603:13
at ZoneDelegate.push../node_modules/
zone.js/dist/zone.js.ZoneDelegate.invoke
(
http://localhost:4200/polyfills.js:12618:26
)
at Object.onInvoke (
http://localhost:4200/vendor.js:74104:33
)
at ZoneDelegate.push../node_modules/
zone.js/dist/zone.js.ZoneDelegate.invoke
(
http://localhost:4200/polyfills.js:12617:52
)
at Zone.push../node_modules/
zone.js/dist/zone.js.Zone.run
(
http://localhost:4200/polyfills.js:12377:43
)
at NgZone.push../node_modules/@angular/core/fesm5/core.js.NgZone.run (
http://localhost:4200/vendor.js:74018:28
)
at PlatformRef.push../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModuleFactory (
http://localhost:4200/vendor.js:74594:23
)
at
http://localhost:4200/vendor.js:74637:59
at ZoneDelegate.push../node_modules/
zone.js/dist/zone.js.ZoneDelegate.invoke
(
http://localhost:4200/polyfills.js:12618:26
)
Okay, How it can be done with DbContext in service, Is there any doc related to?
Thanks.
Hello,
Is there any way to inject dynamic entity in service to write a common method to get data from any table? or any inbuilt method available? Purpose: We need to create common lookup service which can get data from any entity to reduce repeated code for lookup table/dropdown services.
Thanks
Okay, we have generated it initially and may not be included at that time, we will change it accordingly.
Thanks
Hi,
As per the discussion, need to change:
[(ngModel)]="entity.dateField "
<span class="colour" style="color: rgb(36, 41, 46);"> to </span>[(ngModel)]="entity.dateField._d"
<span class="colour" style="color: rgb(36, 41, 46);"> in datepicker input.</span>
<span class="colour" style="color: rgb(36, 41, 46);">Also, initialize your date fields (</span>this.entity.dateField = moment();
<span class="colour" style="color: rgb(36, 41, 46);">) in show method after </span>= new CreateOrEditEntityDto();
so we should add this for all datepickers other than RAD generated views right. how it can be if it is a date and time picker?
Let me try this and get back you.
Thanks.