MenuItem import

UI Components for Angular
Post Reply
AlexP
Posts: 5
Joined: 29 May 2016, 12:26

29 May 2016, 15:01

Hi,

I am new to Angular2 and PrimeNG.

I have tried to set up a test application following the angular.io Quickstart (which was successful) and then added primeng (by adapting the package.json to include primeng v1.0.0-beta.5 and primeui v4.1.11 in the dependencies section -- they include "@angular v2.0.0-rc.1). I managed to see the InputText control, but I have a problem Menubar. It does not find the MenuItem object imported from primeng/primeng as indicated in the PrimeNG web site (in the control list). Is the documentation outdated or am I missing something?

Best regards,
Alex

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

29 May 2016, 18:45

Welcome,

You need PrimeNG beta6, we will check the docs.

AlexP
Posts: 5
Joined: 29 May 2016, 12:26

29 May 2016, 21:55

Hi, thanks for your answer.
Same thing happens with beta6. However, searching in the installed modules (beta6) I found that the MenuItem interface is in components/api/menumodel.

I tried the following, I can see the title and the textbox but nothing under that. What am I missing?



import { Component, OnInit} from '@angular/core';
import {InputText} from 'primeng/primeng';
import {Menubar} from 'primeng/primeng';
import {MenuItem} from 'primeng/components/api/menumodel';

@Component({
selector: 'my-app',
template: `
<h1>My First Angular 2 App</h1>
<input type="text" pInputText />
<p-menubar [model]="items"></p-menubar>
<h1>End</h1>
`,
directives: [InputText, Menubar]
})
export class AppComponent implements OnInit {
private items: MenuItem[];

ngOnInit() {
this.items = [
{
label: 'File'
},
{
label: 'Edit'
}
];
}
}

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests