我有一个角度应用程序仅支持一种语言环境(法语)。然后,我改进了应用程序以支持另一种语言,其中相同的组件在另一个根路径下可用/ar
我现在的问题是应用程序使用了很多 [routerLink]="['some', 'thing'] 和其他 router.navigate('...')。而不是 i18n 所有链接,我正在考虑一个执行 url 转换的智能方法。
我做了以下事情:
this.translateService.onLangChange
.combineLatest(this.router.events)
.subscribe(([langEvent, event]) => {
if (event instanceof NavigationStart) {
let currentUrl = event.url;
let locale = Locale.getLocaleByShortcut(langEvent.lang);
if (locale) {
if (locale.isArabic()) {
if (!ContextUtils.isArabicUrl(currentUrl)) {
this.router.navigate(['/ar/' + currentUrl], {queryParams: this.route.snapshot.queryParams});
}
} else {
if (ContextUtils.isArabicUrl(currentUrl)) {
let url = ContextUtils.frenchifyUrl(currentUrl);
this.router.navigate([url], {queryParams: this.route.snapshot.queryParams});
}
}
}
}
if (event instanceof NavigationEnd) {
if (Config.IS_WEB()) {
$(document).ready(() =>
setTimeout(() => {
Materialize.updateTextFields()
}, 10)
); …Run Code Online (Sandbox Code Playgroud) Intellij在最后一个ubuntu版本18.04中导航Back Forward冲突.问题是,当我不想将新值分配给向左或向右导航到工作区时,我在快捷方式面板中找不到它们.
对此有何解决方案?
我正在使用PrimeFaces p:menuitem组件执行删除.为了添加确认步骤,我使用了onclick显示JavaScript确认对话框的事件.在我的代码下面:
<p:menuitem icon="fa fa-fw fa-remove"
title="#{message.global_remove}"
value="#{message.global_remove}"
actionListener="#{componentListMB.delete(cp.id)}"
onclick="return confirm('#{message.component_list_confirm_deletion}')"
update=":component_list" />
Run Code Online (Sandbox Code Playgroud)
当用户确认删除时,不会触发该操作,而是#在URL的末尾添加a .
为什么在p:commandButton一切正常的情况下不会触发事件?
我正在使用:
我有以下映射器
@Mapper
@Named("RoleBaseMapper")
public interface RoleBaseMapper {
@Mapping(target = "code", source = "name")
@Named("mapToBase")
RoleGuiBaseDto mapToBase(Role role);
@Named("MapListToBase")
List<RoleGuiBaseDto> mapListToBase(List<Role> roles);
}
Run Code Online (Sandbox Code Playgroud)
我期望的是,mapListToBase它将用于mapToBase映射列表中的每个条目。但是当我看到生成的代码时,我有以下内容
@Override
public List<RoleGuiBaseDto> mapListToBase(List<Role> roles) {
if ( roles == null ) {
return null;
}
List<RoleGuiBaseDto> list = new ArrayList<RoleGuiBaseDto>( roles.size() );
for ( Role role : roles ) {
list.add( roleToRoleGuiBaseDto( role ) );
}
return list;
}
protected RoleGuiBaseDto roleToRoleGuiBaseDto(Role role) {
if ( role == null ) {
return …Run Code Online (Sandbox Code Playgroud) angular ×1
angular5 ×1
java ×1
javascript ×1
jsf ×1
jsf-2 ×1
mapstruct ×1
primefaces ×1
ubuntu ×1
ubuntu-18.04 ×1