after updating angular 2 rc5 to angular 2.4 pdf-viewer gives an error that is not a angular component
Check your configuration it seems like you didn't add ng2-pdf-viewer to your app
@VadimDez, why PdfViewer isn't a angular module?
same error ([email protected], [email protected],[email protected])
From my appModule.ts:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { RouterModule, RouteReuseStrategy } from "@angular/router";
import { PdfViewerComponent } from "ng2-pdf-viewer";
....
declarations: [
AppComponent,
PdfViewerComponent,
...
From my component:
```
import {Component, ViewChild} from "@angular/core";
import {Route, ActivatedRoute} from '@angular/router';
import { BibliographyServices } from "../services/bibliographyServices";
import { JournalArticle } from "../models/Bibliography";
import 'rxjs/Rx'; //for map function
import { PdfViewerComponent } from "ng2-pdf-viewer";
@Component({
selector: "pdf-edit-component",
templateUrl: "./pdfEditComponent.html",
host: { class: "pageComponent" }
})
export class PdfEditComponent {
public pdfSrc: string = 'https://vadimdez.github.io/ng2-pdf-viewer/pdf-test.pdf';
page: number = 1;
constructor(public pdfViewerComponent: PdfViewerComponent, private bibliographyService: BibliographyServices, private route: ActivatedRoute) {
}
...
And my html page:
```
I don't see if I'm forgetting something
In case it is related, I installed ng2-pdf-viewer after an angular update, and compiler warms about problems in zone.js and in jquery, I supose relating to angular package.json versions. I update both modules from github so. If I comment the pdf-viewer element in html, the application is fine.
i have the same issue....
+1 Same Issue
any timeline???
thank you.
Could anybody show me how to reproduce it? Tried myself got no problems.
@ces10 your problem is that you doing something that you shouldn't, Remove public pdfViewerComponent: PdfViewerComponent from
constructor(public pdfViewerComponent: PdfViewerComponent) {}
@VadimDez Many thanks, it works!
ERROR Error: Uncaught (in promise): Error: Template parse errors:
'pdf-viewer' is not a known element:
click me to view PDF in Iframe!
--
Please help me
@balamca7 here's documentation: https://github.com/VadimDez/ng2-pdf-viewer
see how to integrate it in your project there.
@VadimDez
yes i follow this document, but get this error.
I am using angular version 4.
@balamca7 the error that you've sent before is saying that component is not found - means that you imported PdfViewerModule in the wrong place or imported it wrongly.
For anyone else, I had this problem when I had a module for my page component, and I had added the PdfViewerModule import in app.module.ts instead of my page-level module.ts. I moved the PdfViewerModule import to my page-level module.ts.
I was having this issue even with the import in the sub-module. I'm not sure which of these things did the trick, but I closed VS Code, did npm install, reran ng build --watch, then opened VS Code again.
I was having this issue, I checked all the possible solutions, but in vain. I was opening a mat dialog from component and showing pdf in that mat dialog, then this error is coming "Pdf-viewer is not an angular component". I tried adding Pdfviewer at the app module, page module but did not work, then I checked the module file and found out that I have not added the mat dialog component in my main module file i.e this error. I added a mat dialog component in my module and everything works fine.
So, please check things carefully, the problem might be somewhere else, not in this pdf viewer module.