primeng icon indicating copy to clipboard operation
primeng copied to clipboard

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

Open partha006 opened this issue 10 years ago • 5 comments

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

partha006 avatar Nov 29 '16 11:11 partha006

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

Mrtcndkn avatar Dec 01 '16 11:12 Mrtcndkn

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

GZTiempo avatar Dec 20 '16 14:12 GZTiempo

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

igogu avatar Dec 29 '16 19:12 igogu

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.

ghost avatar Feb 11 '17 10:02 ghost

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.

sudheerj avatar Apr 17 '17 07:04 sudheerj