Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
895 views
in Technique[技术] by (71.8m points)

kendo ui - get [Object object ] when using panelbar Angular

I am trying to bind local data to kendo panelbar but I get [object object] instead of correct data.

In my component :

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 },
   ];
 }

This is what I have when I run it : enter image description here

Can anyone help me please ?

question from:https://stackoverflow.com/questions/65918597/get-object-object-when-using-panelbar-angular

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

1 Answer

0 votes
by (71.8m points)

<PanelBarItemModel> {title: 'Address info', content: this.x }, content value should be string and not array of objects You can write like

public ad: Array<PanelBarItemModel> = [
      <PanelBarItemModel> {title: 'Address info', content: `Address- ${this.x[0].adress}, housenum - ${this.x[1].housenum}` },
   ];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
...