Primeng: Cannot find name 'MenuItem' in primeng while using like private items: MenuItem[];

Created on 29 Nov 2016  路  5Comments  路  Source: primefaces/primeng

I was trying to implement the sample in the below url

http://www.primefaces.org/primeng/#/menubar

but getting the error on the line private items: MenuItem[]; as cannot find name 'MenuItem' even though i used import {MenuModule,MenuItem} from 'primeng/primeng'; in app.module.ts

Most helpful comment

You have to import MenuItem in the component where you are going to use it, you can't import it in app.module.ts because you can't include it in ngmodule imports

All 5 comments

I checked it locally but it seems to be working fine.

Hi, i have installed the primeng but i have the same issue shall i install it from another source?

You have to import MenuItem in the component where you are going to use it, you can't import it in app.module.ts because you can't include it in ngmodule imports

Thx for @igogu . It works. I tried like this:

  1. in 'app.module.ts' import MenuModule
  2. and in 'app.component.ts' import MenuItem

I think that the tutorial http://www.primefaces.org/primeng/#/menubar should be fix.

The showcase documentation import doesn't mean only for app module .It mentioned as what specific modules and classes need to be imported(for both component.ts,module.ts) to work with the component.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miresk picture miresk  路  3Comments

SchneMa picture SchneMa  路  3Comments

markgoho picture markgoho  路  3Comments

watalberto picture watalberto  路  3Comments

philly-vanilly picture philly-vanilly  路  3Comments