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: Template parse errors: There is no directive with "exportAs" set to "paginationApi"

See original GitHub issue

Angular 2 version: 2.4.5 ng2-pagination version: 2.0.0 Description of issue: Getting an error in the console which is preventing my app from loading:

main.browser.ts:25
SyntaxError
_nativeError
:
Error: Template parse errors: There is no directive with "exportAs" set to "paginationApi" (" <pagination-template [ERROR ->]#p="paginationApi" [id]="id" [maxSize]="maxSize" "): PaginationControlsComponent@1:26 Can't bind to 'maxSize' since it isn't a known property of 'pagination-template'. 1. If 'pagination-template' is an Angular component and it has 'maxSize' input, then verify that it is part of this module. 2. If 'pagination-template' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("pagination-template #p="paginationApi" [id]="id" [ERROR ->][maxSize]="maxSize" (pageChange)="pageChange.emit($event)"> <ul class="n"): PaginationControlsComponent@3:25 at SyntaxError.BaseError [as constructor] (http://localhost:3000/vendor.dll.js:70873:27) [<root>] at new SyntaxError (http://localhost:3000/vendor.dll.js:6256:16) [<root>] at TemplateParser.parse (http://localhost:3000/vendor.dll.js:19415:19) [<root>] at JitCompiler._compileTemplate (http://localhost:3000/vendor.dll.js:51921:68) [<root>] at http://localhost:3000/vendor.dll.js:51804:62 [<root>] at Set.forEach (native) [<root>] at JitCompiler._compileComponents (http://localhost:3000/vendor.dll.js:51804:19) [<root>] at createResult (http://localhost:3000/vendor.dll.js:51687:19) [<root>] at Zone.run (http://localhost:3000/polyfills.dll.js:4100:43) [<root> => <root>] at http://localhost:3000/polyfills.dll.js:4507:57 [<root>] at Zone.runTask (http://localhost:3000/polyfills.dll.js:4138:47) [<root> => <root>] at drainMicroTaskQueue (http://localhost:3000/polyfills.dll.js:4405:35) [<root>] at HTMLDocument.ZoneTask.invoke (http://localhost:3000/polyfills.dll.js:4336:25

Steps to reproduce: I’m using webpack, specifically https://github.com/AngularClass/angular2-webpack-starter. I npm install ng2-pagination and import { PaginationService } from 'ng2-pagination'; in my app.module. I register PaginationService as a provider in app.module.

In shared.module…

//imports
...
import { PaginatePipe } from 'ng2-pagination';

// Components
...
import { PaginationControlsComponent } from 'ng2-pagination';
...


@NgModule({
  imports: [
    ...
  ],
  declarations: [
    ...
    PaginationControlsComponent,
    ...
  ],
  exports: [
    ...
    PaginatePipe,
    ...
  ],
})
export class SharedModule { }

In a component I am using import { PaginatePipe } from 'ng2-pagination'; and import { PaginationInstance } from 'ng2-pagination';

Expected result: App should load and I should not receive an error in the console.

Actual result:

Receive an error in the console.

Demo: (if possible, edit this Plunker demo and paste the link to your fork)

Any relevant code: In my component ts…

paginationConfig: PaginationInstance = {
    itemsPerPage: this.config.pagination.defaultItemsPerPage,
    currentPage: 1
 };

In my template…

<pagination-controls #p (pageChange)="onPageChange($event)">
        <pagination-template [p]="p"></pagination-template>
        <form class="inline">
          <per-page [paginationConfig]="paginationConfig" class="control"></per-page>
          <go-to-page [p]="p" class="control"></go-to-page>
        </form>
</pagination-controls>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alainvdcommented, Nov 23, 2017

To get rid of this error, just rename your component to pagination-template as the directive is being applied to this component.

0reactions
RichaPandey02commented, Aug 31, 2021

I am getting the same error what is the solution?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular2 Error: There is no directive with "exportAs" set to ...
Error : Template parse errors: There is no directive with "exportAs" set to "ngModel". Which was reported as a bug in github, then...
Read more >
Dec 03 2019 00:33 UTC - angular/angular - Gitter
There is no directive with "exportAs " set to "paginationApi" ("nation-controls"> ... Error: Template parse errors: at syntaxError ...
Read more >
NG8003: No directive found with export - Angular
Debugging the errorlink. Use the string name of the export not found to trace the templates or modules using this export. Ensure that...
Read more >
Fix : No Directive found with exportAs 'ngForm' in Angular
No Directive found with exportAs 'ngForm' in Angular. ... Angular error Can't bind to 'ngModel' since it isn't a known property of input....
Read more >
There is no directive with "exportAs" set to "ngForm" - SyntaxFix
i'm on the RC4 and i'm getting the error There is no directive with "exportAs" set to "ngForm" because of my template :...
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