ng2-select icon indicating copy to clipboard operation
ng2-select copied to clipboard

ng2-select Children version does not work

Open newerik opened this issue 9 years ago • 5 comments

The Children version does not work. Not even on the Demo page: http://valor-software.com/ng2-select/ (Neither in my development. It did work, but recently I updated my package.json along with the downloaded node_modules. First I experienced this error on my page, but the official demo does not work either.) Checked in the latest Firefox and Chrome.

newerik avatar Jan 19 '17 09:01 newerik

Currently the latest is v1.2.0 I have downgraded ng2-select in my development to v1.1.2 and with this version Children works again.

newerik avatar Jan 19 '17 10:01 newerik

I had the same problem. The problem is that the children version expects an id. You can just set a dummy id for your parents and it's working again!

elmartino avatar Feb 15 '17 20:02 elmartino

  public items:Array<any> = [
    {
      id: 1,
      text: 'Austria',
      children: [
        {id: 54, text: 'Vienna'}
      ]
    },
    {
      id: 2,
      text: 'Belgium',
      children: [
        {id: 2, text: 'Antwerp'},
        {id: 9, text: 'Brussels'}
      ]
    }
    ]

mahabubakram avatar Apr 28 '17 13:04 mahabubakram

but item set is public items:Array = [ { id: 1, text: 'Austria', }, { id: 2, text: 'Belgium', children: [ {id: 2, text: 'Antwerp'}, {id: 9, text: 'Brussels'} ] } ] not work

duongphamit avatar Sep 26 '17 09:09 duongphamit

Hi, Is there any way to style the parent item? From the template, it seems that if the list contains childrens the 'text' of the parent is rendered as it is. However for the child items, it is sanitized and injected inside the Div.

From the below example, i want to add my custom style to the parent item(different style to different parent, hence can't use the existing class "dropdown-header" for styling), it works for childrens but doesn't work for parent.

public items:Array = [ { id: 1, text: <div class='level-indent-1'>Austria</div>, children: [ {id: 54, text: <div class='level-indent'>Vienna</div>} ] }, { id: 2, text: <div class='level-indent-2'>Belgium</div>, children: [ {id: 2, text: 'Antwerp'}, {id: 9, text: 'Brussels'} ] } ]

pooja23 avatar Jan 16 '18 14:01 pooja23