使用面板栏 Angular 时获取 [Object object ]
get [Object object ] when using panelbar Angular
我正在尝试将本地数据绑定到 kendo 面板栏,但我得到的是 [object object] 而不是正确的数据。
在我的组件中:
import { Component } from '@angular/core';
import { PanelBarItemModel } from '@progress/kendo-angular-layout';
@Component({
selector: 'my-app',
styles: [`
:host /deep/ .k-content {
padding: 4px 8px;
}
` ],
template: `
<div class="panelbar-wrapper">
<kendo-panelbar [items]="ad"></kendo-panelbar>
</div>`
})
export class AppComponent {
x : any = [{'adress' : '124 JD'}, {'housenum': 1254}]
public ad: Array<PanelBarItemModel> = [
<PanelBarItemModel> {title: 'Address info', content: this.x },
];
}
这是我 运行 时所拥有的:
有人可以帮我吗?
<PanelBarItemModel> {title: 'Address info', content: this.x },
内容值应该是字符串而不是对象数组
你可以这样写
public ad: Array<PanelBarItemModel> = [
<PanelBarItemModel> {title: 'Address info', content: `Address- ${this.x[0].adress}, housenum - ${this.x[1].housenum}` },
];
我正在尝试将本地数据绑定到 kendo 面板栏,但我得到的是 [object object] 而不是正确的数据。
在我的组件中:
import { Component } from '@angular/core';
import { PanelBarItemModel } from '@progress/kendo-angular-layout';
@Component({
selector: 'my-app',
styles: [`
:host /deep/ .k-content {
padding: 4px 8px;
}
` ],
template: `
<div class="panelbar-wrapper">
<kendo-panelbar [items]="ad"></kendo-panelbar>
</div>`
})
export class AppComponent {
x : any = [{'adress' : '124 JD'}, {'housenum': 1254}]
public ad: Array<PanelBarItemModel> = [
<PanelBarItemModel> {title: 'Address info', content: this.x },
];
}
这是我 运行 时所拥有的:
有人可以帮我吗?
<PanelBarItemModel> {title: 'Address info', content: this.x },
内容值应该是字符串而不是对象数组
你可以这样写
public ad: Array<PanelBarItemModel> = [
<PanelBarItemModel> {title: 'Address info', content: `Address- ${this.x[0].adress}, housenum - ${this.x[1].housenum}` },
];