首页 > 解决方案 > 当我将属性传递给带有管道的组件时,如何将一个日期与字符串连接起来?

问题描述

我正在使用 kendoUi 的一个组件,我需要传递属性 [title] 我的变量local.localNome (string)和 local.LocalDataCadastro(Date with a pipe)

我尝试类似:

<kendo-panelbar-item *ngFor="let local of locaisList" [title]="local.LocalCadastroData | date + local.LocalNome">

但这样我收到:

[local.LocalCadastroData | 中第 32 列的意外标记“+” 日期 + local.LocalNome]

我如何在[title]属性中使用我的两个变量和pipe日期?

标签: angular

解决方案


尝试将 date 和 local.LocalNome 放在括号中,以便它作为 JS 执行。

<kendo-panelbar-item *ngFor="let local of locaisList" [title]="local.LocalCadastroData | {{date + local.LocalNome}}">

推荐阅读