Error in your sample of MegaMenu with PrimeNG 4.1.3

Post Reply
lne
Posts: 44
Joined: 30 Mar 2017, 08:47

21 Aug 2017, 07:26

Your sample

Code: Select all

this.items = [
                {
                    label: 'TV', icon: 'fa-check',
                    items: [
                        [
                            {
                                label: 'TV 1',
                                items: [{label: 'TV 1.1'},{label: 'TV 1.2'}]
                            },
                            {
                                label: 'TV 2',
                                items: [{label: 'TV 2.1'},{label: 'TV 2.2'}]
                            }
                        ],
                        [
                            {
                                label: 'TV 3',
                                items: [{label: 'TV 3.1'},{label: 'TV 3.2'}]
                            },
                            {
                                label: 'TV 4',
                                items: [{label: 'TV 4.1'},{label: 'TV 4.2'}]
                            }    
                        ]
                    ]
                },
                {
                    label: 'Sports', icon: 'fa-soccer-ball-o',
                    items: [
                        [
                            {
                                label: 'Sports 1',
                                items: [{label: 'Sports 1.1'},{label: 'Sports 1.2'}]
                            },
                            {
                                label: 'Sports 2',
                                items: [{label: 'Sports 2.1'},{label: 'Sports 2.2'}]
                            },

                        ],
                        [
                            {
                                label: 'Sports 3',
                                items: [{label: 'Sports 3.1'},{label: 'Sports 3.2'}]
                            },
                            {
                                label: 'Sports 4',
                                items: [{label: 'Sports 4.1'},{label: 'Sports 4.2'}]
                            }
                        ],
                        [
                            {
                                label: 'Sports 5',
                                items: [{label: 'Sports 5.1'},{label: 'Sports 5.2'}]
                            },
                            {
                                label: 'Sports 6',
                                items: [{label: 'Sports 6.1'},{label: 'Sports 6.2'}]
                            }
                        ]
                    ]
                }
            ];
generate an error

severity: 'Erreur'
message: 'Type '{ label: string; icon: string; items: { label: string; items: { label: string; }[]; }[][]; }[]' is not assignable to type 'MenuItem[]'.
Type '{ label: string; icon: string; items: { label: string; items: { label: string; }[]; }[][]; }' is not assignable to type 'MenuItem'.
Types of property 'items' are incompatible.
Type '{ label: string; items: { label: string; }[]; }[][]' is not assignable to type 'MenuItem[]'.
Type '{ label: string; items: { label: string; }[]; }[]' has no properties in common with type 'MenuItem'.'

merve7
Posts: 98
Joined: 12 Sep 2017, 10:44

13 Nov 2017, 13:02

We fixed in previous versions. Please can you check again?

User avatar
optimus.prime
Prime
Posts: 17718
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

01 Dec 2017, 10:58

Try with PrimeNG 5.0 please, it was fixed, you need Angular 5 though for that.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest