question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"ERROR in Ng2PaginationModule is not an NgModule" after compiling succesfully

See original GitHub issue

Angular 2 version: 2.3.1

ng2-pagination version: 2.0.0

Description of issue: After importing the Ng2PaginationModule in my app.module.ts, everything works, but after building (angular-cli@latest) it outputs an error: ERROR in Ng2PaginationModule is not an NgModule

Steps to reproduce: Simply install using NPM and use in your application.

import { Ng2PaginationModule } from 'ng2-pagination';

...

@NgModule({
  imports: [
    BrowserModule,
    Ng2PaginationModule,
    FormsModule,
    HttpModule
  ],
...

Expected result: Everything should compile without errors. Actually, it compiles and outputs all bundle files, but after it’s done it still throws an error, messing with my teamcity build.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
beligh-hamdicommented, Apr 30, 2017

<pagination-controls (pageChange)=“p = $event”></pagination-controls>

export class XComponent { … p: number;

just add p in your typescript, add should be work. (test it on my app with ng cli 1.0.0à ng build --prod

1reaction
michaelbromleycommented, Apr 21, 2017

@NYearOldCoder The reason is that ng build does not do the step of compiling your templates into TypeScript, which does happen then you use the --prod flag. Once a template is compiled into a TypeScript class, it becomes apparent that the variable “p” does not exist on the component, leading to the error.

In dev mode (ng build) this compilation step happens dynamically at run-time, and therefore the TypeScript compiler does not get a chance to complain about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Appears in the NgModule.imports of AppModule, but could not ...
After updating my app from Angular 9 -> 10 -> 11, I received the NG6002 error for package "ngx-lightbox" when attempting ng build...
Read more >
NgModule FAQ - Angular
An NgModule can even export a module that it doesn't import. What should I not export?link. Don't export the following: Private components, directives,...
Read more >
Angular Modules and NgModule - Complete Guide
If we try to use a component directly that is not part of a module, we will get the following error: Unhandled Promise...
Read more >
Quick Angular fix: the NgModule 'AppModule' needs to be ...
When working on a Angular project I got the following error when working with multiple modules: The NgModule 'AppModule' needs to be compiled...
Read more >
Server-side pagination in Angular with ngx-pagination
Once the installation is done successfully, open the project ... import {NgxPaginationModule} from 'ngx-pagination'; @NgModule({ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found