无法绑定到 'src',因为它不是 'ngx-extended-pdf-viewer' Angular8+ 的已知 属性
Can't bind to 'src' since it isn't a known property of 'ngx-extended-pdf-viewer' Angular8+
我目前正在使用 ngx-extended-pdf-viewer 和 Angular8+ 来呈现 PDF,它不起作用。而且我不断收到运行时错误 "Can't bind to 'src' since it isn't a known property of 'pdf-viewer'".
有人知道这是为什么吗?
这是我的 HTML:
<div class="row">
<div class="col-md-12">
<div class="card-body">
<ngx-extended-pdf-viewer
[src]="pdfSrc"
[useBrowserLocale]="true"
[textLayer]="true"
[showHandToolButton]="true"
[height]="'100vh'">
</ngx-extended-pdf-viewer>
</div>
</div>
</div>
我的app.module.ts
...
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
@NgModule({
imports: [
NgxExtendedPdfViewerModule,
....
],
declarations: [
AppComponent,
...
],
providers: [
...
],
bootstrap: [AppComponent]
})
export class AppModule { }
这是我的.ts
import { Component, OnInit } from '@angular/core';
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
@Component({
selector: 'app-video-reader',
templateUrl: './video-reader.component.html',
styleUrls: ['./video-reader.component.css'],
providers: [NgxExtendedPdfViewerModule]
})
export class VideoReaderComponent implements OnInit {
pdfSrc = "assets/example.pdf"; /* PDF*/
constructor() { }
...
ngOnInit(): void {
this.video = 'jYvkMv7LzCw';
this.init();
}
...
}
我的app.component.ts
import { Component} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
}
尝试[(src)]="pdfSrc"
这是一个双向绑定属性。
我通过以下方式解决了我的问题:
> npm update
> npm install
> npm audit fix --force
我目前正在使用 ngx-extended-pdf-viewer 和 Angular8+ 来呈现 PDF,它不起作用。而且我不断收到运行时错误 "Can't bind to 'src' since it isn't a known property of 'pdf-viewer'".
有人知道这是为什么吗?
这是我的 HTML:
<div class="row">
<div class="col-md-12">
<div class="card-body">
<ngx-extended-pdf-viewer
[src]="pdfSrc"
[useBrowserLocale]="true"
[textLayer]="true"
[showHandToolButton]="true"
[height]="'100vh'">
</ngx-extended-pdf-viewer>
</div>
</div>
</div>
我的app.module.ts
...
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
@NgModule({
imports: [
NgxExtendedPdfViewerModule,
....
],
declarations: [
AppComponent,
...
],
providers: [
...
],
bootstrap: [AppComponent]
})
export class AppModule { }
这是我的.ts
import { Component, OnInit } from '@angular/core';
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
@Component({
selector: 'app-video-reader',
templateUrl: './video-reader.component.html',
styleUrls: ['./video-reader.component.css'],
providers: [NgxExtendedPdfViewerModule]
})
export class VideoReaderComponent implements OnInit {
pdfSrc = "assets/example.pdf"; /* PDF*/
constructor() { }
...
ngOnInit(): void {
this.video = 'jYvkMv7LzCw';
this.init();
}
...
}
我的app.component.ts
import { Component} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
}
尝试[(src)]="pdfSrc"
这是一个双向绑定属性。
我通过以下方式解决了我的问题:
> npm update
> npm install
> npm audit fix --force