- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 webpack 将 ng2-pdf-viewer
集成到我的 angular 6 应用程序中。
我已按照说明在此处添加模块;
这样,入口就添加到了我的包.json中,如下;
{
"name": "myApp",
"private": true,
"version": "0.0.0",
"scripts": {
"start": "concurrently \"webpack-dev-server --env=dev --open --hot --inline --port 8080\" \"dotnet run\" ",
"node-sass": "npm rebuild node-sass",
"webpack-dev": "webpack --env=dev",
"webpack-production": "webpack --env=prod",
"build-dev": "npm run webpack-dev",
"build-production": "npm run webpack-production",
"watch-webpack-dev": "webpack --env=dev --watch --color",
"watch-webpack-production": "npm run build-production --watch --color",
"publish-for-iis": "npm run build-production && dotnet publish -c Release",
"test": "karma start",
"test-ci": "karma start --single-run --browsers ChromeHeadless",
"lint": "tslint ./ClientApp"
},
"dependencies": {
"@agm/core": "^1.0.0-beta.3",
"@angular-devkit/core": "^0.6.8",
"@angular/animations": "^6.0.7",
"@angular/common": "^6.0.7",
"@angular/compiler": "^6.0.7",
"@angular/compiler-cli": "^6.0.7",
"@angular/core": "^6.0.7",
"@angular/forms": "^6.0.7",
"@angular/http": "^6.0.7",
"@angular/platform-browser": "^6.0.7",
"@angular/platform-browser-dynamic": "^6.0.7",
"@angular/platform-server": "^6.0.7",
"@angular/router": "^6.0.7",
"@angular/upgrade": "^6.0.7",
"@ks89/angular-modal-gallery": "^6.2.0",
"angular2-useful-swiper": "5.0.1",
"bootstrap": "3.3.7",
"core-js": "2.5.7",
"font-awesome": "^4.7.0",
"hammerjs": "2.0.8",
"ie-shim": "0.1.0",
"mousetrap": "1.6.2",
"ng2-pdf-viewer": "^5.2.3",
"rxjs": "6.2.1",
"rxjs-compat": "6.2.1",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@ngtools/webpack": "^6.0.8",
"@types/jasmine": "^2.8.8",
"@types/node": "^10.5.2",
"@types/hammerjs": "^2.0.35",
"@types/mousetrap": "^1.6.0",
"angular-router-loader": "0.8.5",
"angular2-template-loader": "^0.6.2",
"awesome-typescript-loader": "^5.2.0",
"clean-webpack-plugin": "^0.1.19",
"codelyzer": "^4.4.2",
"concurrently": "^3.6.0",
"copy-webpack-plugin": "^4.5.2",
"css-loader": "^1.0.0",
"file-loader": "^1.1.11",
"html-webpack-plugin": "^3.2.0",
"jasmine-core": "3.1.0",
"jquery": "^3.3.1",
"json-loader": "^0.5.7",
"karma": "^2.0.4",
"karma-chrome-launcher": "^2.2.0",
"karma-jasmine": "^1.1.2",
"karma-jasmine-html-reporter": "^1.2.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^3.0.0",
"loader-utils": "^1.1.0",
"node-sass": "^4.9.2",
"raw-loader": "^0.5.1",
"rimraf": "^2.6.2",
"sass-loader": "^7.0.3",
"source-map-loader": "^0.2.3",
"style-loader": "^0.21.0",
"tslint": "^5.11.0",
"tslint-loader": "^3.6.0",
"typescript": "2.7.2",
"uglifyjs-webpack-plugin": "^1.2.7",
"url-loader": "^1.0.1",
"webpack": "^4.16.5",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.4"
},
"-vs-binding": {
"AfterBuild": [
"node-sass",
"build-dev"
]
}
}
我可以确认 ng2-pdf-viewer 文件夹已添加到我的 node_modules 文件夹中。
然后我添加到我的 app.module.ts
;
import { NgModule } from "@angular/core";
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { PdfViewerModule } from 'ng2-pdf-viewer';
import { AppComponent } from "./app.component";
import { AppRoutes } from "./app.routes";
import { CoreModule } from "./core/core.module";
import { HomeModule } from "./home/home.module";
import { PressModule } from "./press/press.module";
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
ReactiveFormsModule,
PdfViewerModule,
AppRoutes,
CoreModule.forRoot(),
HomeModule,
PressModule
],
declarations: [
AppComponent
],
bootstrap: [AppComponent]
})
export class AppModule { }
然后在我的 press.component.html
中有以下内容;
import { Component } from "@angular/core";
@Component({
selector: "press-component",
templateUrl: "./press.component.html",
styleUrls: ["./press.component.scss"]
})
export class PressComponent {
pdfSrc: string = "https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf";
constructor() {
}
}
和我的press.component.html
;
<pdf-viewer [src]="pdfSrc"
[render-text]="true"
style="display: block;"></pdf-viewer>
但是,当我运行 npm run webpack-production
时,出现以下错误;
ERROR in : Can't bind to 'src' since it isn't a known property of 'pdf-viewer'.
1. If 'pdf-viewer' is an Angular component and it has 'src' input, then verify that it is part of this module.
2. If 'pdf-viewer' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("sm-12 text-center">
<pdf-viewer [ERROR ->][src]="pdfSrc"
[render-text]="true"
style="display:") : Can't bind to 'render-text' since it isn't a known property of 'pdf-viewer'.
1. If 'pdf-viewer' is an Angular component and it has 'render-text' input, then verify that it is part of this module.
2. If 'pdf-viewer' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
<pdf-viewer [src]="pdfSrc"
[ERROR ->][render-text]="true"
style="display: block;"></pdf-viewer>
</div> ") : 'pdf-viewer' is not a known element:
1. If 'pdf-viewer' is an Angular component, then verify that it is part of this module.
2. If 'pdf-viewer' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" class="col-sm-12 text-center">
[ERROR ->]<pdf-viewer [src]="pdfSrc"
[render-text]="true"
sty")
任何人都可以帮助解释为什么会发生这种情况以及我该如何解决这个问题?
最佳答案
此错误是由于 Angular 无法找到 PdfViewerModule。看起来您有一个子模块,并且那里缺少 PdfViewerModule 声明。您是否有名为“press.module.js”之类的子模块?
关于angular - Angular 6 'pdf-viewer' 的 ng2-pdf-viewer 不是已知对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54096135/
我试图隔离一些我使用 viewer.model.search 方法搜索的元素,但是当我使用 viewer.isolate 方法时,我隐藏了所有内容. 我已经使用 getSelection 来隔离元素,
我正在尝试使用 webpack 将 ng2-pdf-viewer 集成到我的 angular 6 应用程序中。 我已按照说明在此处添加模块; ng2-pdf-viewer instructions 这
我正在尝试使用 webpack 将 ng2-pdf-viewer 集成到我的 angular 6 应用程序中。 我已按照说明在此处添加模块; ng2-pdf-viewer instructions 这
I hope this message finds you well. I am writing to discuss a matter concerning our ongoing devel
Xcode 4.5.2 Mountain Lion,Mac 应用 我严格遵守文档。帮助文件夹及其子文件夹已添加到项目/Resources 文件夹并显示为蓝色。 如有必要,文件夹引用由 xcode 添加
我有一个 API,它以 blob 形式返回上传的文件。当我尝试将 src 与 blob URL 绑定(bind)时,它不会显示任何内容,但是,当我尝试绑定(bind)直接 URL 时,它可以显示 PD
rstudioapi::viewer可以从 temp 目录呈现静态 html 页面,如下例所示。 dir Thank you for using Tidycells It is an assistan
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
要查看全局程序集缓存中的程序集列表,请在命令提示符下键入以下命令:gacutil –l 在早期版本的 .NET Framework 中,Shfusion.dll Windows shell 扩展使您能
我正在创建 Java 桌面应用程序。我正在使用碧 Jade 报告来创建报告。 是否有一些方法可以调用 JasperViewer 如果没有出现结果集不包含任何数据?我只想要消息对话框''文档没有页面。"
相当简单的问题,没有人知道用于浏览msi日志文件的良好实用程序吗? 对提供过滤功能,对不同标准和自定义操作,操作顺序,属性和错误的清晰了解的所有内容感兴趣。 谢谢。 最佳答案 我发现the tip f
我有一个具有 PDF 文件查看者角色的应用程序。虽然我的应用程序不编辑 PDF 文件,但它允许用户保存 PDF 文件(如果该文件对于我的应用程序处理的工作流程来说太大或太复杂)。 当调用 SaveDo
我试图从 twitch 获取观看者列表,但它一直给我一个错误,即使我很确定我的格式正确...... 这是代码和 here is an example on jsfiddle: $(document).
这对我来说是另一个面向可用性的问题...... 有没有办法让结果查看器在提交新内容时“自动定位”到最新输出的顶部? 有时,结果查看器会显示刚刚生成的表格的底部。有时,它显示表格的顶部,而不是“最顶部”
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我用了https://github.com/Autodesk-Forge/viewer-react-express-headless作为我的 Forge React 应用程序的起点,我将 viewer
我正在 Nuke10 中编写时间线同步脚本。我应该更改全局框架设置。示例: nuke.root().knob('first_frame').setValue(1) nuke.root().knob('
我正在尝试将按钮调整为仅在设备为手机时显示导航工具。我正在使用以下代码: viewer.toolbar.getControl('settingsTools').setVisible(false);
你好,我正在制作一个打开进程 VNC-Viewer 的 WindowsForms 应用程序。 这是我的代码,我传递了我想要连接的 ip 作为参数并且有效。 ProcessStartInfo start
我正在使用 Android SDK 附带的 Hierarchy Viewer 工具进行一些测试。 我正在测试的 Activity 具有以下 xml: Sl
我是一名优秀的程序员,十分优秀!