2

I added primeng (6.0.0) as dependency in Stackblitz (Angular 6.0.6) and tried to import primeng modules (e.g. TreeModule) but it doesn't find it, you may see the code in below stackblitz:

https://stackblitz.com/edit/angular-wqef8y

The app.module.ts can't find primeng modules.

Any idea how to fix it?

Farhad
  • 533
  • 9
  • 21

1 Answers1

1

Just the intelisense does not find the module for some reason and gives an error. Else the code works if you import the TreeModule in the AppModule.

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';

import { AppComponent } from './app.component';
import { HelloComponent } from './hello.component';

import {TreeModule} from 'primeng/tree';


@NgModule({
  imports:      [ BrowserModule, FormsModule, BrowserAnimationsModule, TreeModule ],
  declarations: [ AppComponent, HelloComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

Here is a fork of your stakblitz example that I fixed to work. StackBlitz Link It still shows the error in the editor. I have also added the styles in the styles.css file so it displays correctly.

Aleš Doganoc
  • 11,568
  • 24
  • 40
  • just to add as you did, adding the styles are necessary too :: @ import url("../node_modules/primeicons/primeicons.css"); @ import "~primeng/resources/themes/omega/theme.css"; @ import "~primeng/resources/primeng.min.css"; – Farhad Jun 22 '18 at 21:21