Skip to content

Commit

Permalink
Closes #12, updated how-to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimDez authored Sep 3, 2016
1 parent 8f2a200 commit 8427319
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,31 @@ npm install ng2-pdf-viewer --save

In case you're using ```systemjs``` see configuration [here](https://github.com/VadimDez/ng2-pdf-viewer/blob/master/SYSTEMJS.md).

Import component to your component
Add ```PdfViewerComponent``` to your module's ```declarations```

```js
import { Component } from '@angular/core';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';

import { PdfViewerComponent } from 'ng2-pdf-viewer';

@NgModule({
imports: [BrowserModule],
declarations: [AppComponent, PdfViewerComponent],
bootstrap: [AppComponent]
})

class AppModule {}

platformBrowserDynamic().bootstrapModule(AppModule);
```

And then use it in your component

```js
import { Component } from '@angular/core';

@Component({
selector: 'example-app',
template: `
Expand All @@ -31,9 +50,12 @@ import { PdfViewerComponent } from 'ng2-pdf-viewer';
<label>Page:</label>
<input type="number" placeholder="Page" [(ngModel)]="page">
</div>
<pdf-viewer [src]="pdfSrc" [initialPage]="page" [original-size]="true" style="display: block;"></pdf-viewer>
`,
directives: [PdfViewerComponent]
<pdf-viewer [src]="pdfSrc"
[initialPage]="page"
[original-size]="true"
style="display: block;"
></pdf-viewer>
`
})
export class AppComponent {
pdfSrc: string = '/pdf-test.pdf';
Expand Down

0 comments on commit 8427319

Please sign in to comment.