我正在为Angular使用ng2-pdf-viewer库,我正在尝试从基本URL显示PDF.问题是我收到以下错误:
XMLHttpRequest无法加载 https://www.bbv.ch/images/bbv/pdf/Publikationen/BBV16Poster_Angular2.pdf.请求的资源上不存在"Access-Control-Allow-Origin"标头.原产地" 的http://本地主机:54800 ",因此没有允许访问.
这是我的代码:
.ts:
{ Name: "Angular2 tuto", Description: "An amazing Angular2 pdf !", Url: {url: "https://www.bbv.ch/images/bbv/pdf/Publikationen/BBV16Poster_Angular2.pdf", withCredentials: true} }
Run Code Online (Sandbox Code Playgroud)
.html:
<pdf-viewer [src]="document.Url" [page]="1" [original-size]="false" style="display: block;"></pdf-viewer>
Run Code Online (Sandbox Code Playgroud)
我尝试了没有"withCredentials"属性 - 没有改变..
如何从angular2中的链接显示任何pdf?(虽然工作在一个基本的iframe ......)
我正在尝试在加载数据时显示加载图标,然后在数据准备好时显示数据.问题是我几秒钟,我可以看到加载图标和数据......
这是我的代码
$scope.items[y].content.push({ text: '', loading: true });
API.getContent(id, x, y, function (response, x, y) {
$scope.items[y].content[x].loading = false;
$scope.items[y].content[x].text = response.data.text;
});
Run Code Online (Sandbox Code Playgroud)
我的看法 :
<i ng-show="item.loading" class="fa fa-spinner fa-pulse fa-2x"></i>
<p ng-hide="item.loading" class="portal-subtitle" ng-bind-html="item.text"></p>
Run Code Online (Sandbox Code Playgroud)
我的内容是异步加载的.我得到结果时,加载值设置为false,因此此时图标应该是不可见的......但事实并非如此!(如图所示).
不知道怎么解决这个问题?
编辑:
我显示了我的"item.loading"的值.看起来当值从true变为false时,会显示文本,但图标仍然在这里几秒钟......这有帮助吗?
谢谢你的帮助
我想在npm的Angular2组件(我的通用网格,我的通用按钮等)和模块(我的网格模块中的客户端)中创建我的库,但我找不到任何在线工作示例(我确实发现了一些,但它永远不会奏效......
index.js:
export { PortalGridComponent } from './src/portal-grid/portal-grid.component';
Run Code Online (Sandbox Code Playgroud)
这是我的package.config.json:
{
"name": "my-perso-components",
"version": "1.0.13",
"main": "index.js",
"scripts": {
"nbuild": "tsc index.ts --outDir ./lib",
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": …Run Code Online (Sandbox Code Playgroud) 我正在使用C#为CRM创建导入/导出工具.有时,我遇到导入错误,只有此消息"解决方案清单导入:失败"在我的捕获中.我试图将它转换为它的类型(FaultException),但我没有更多的细节.
如果我直接在CRM中导入相同的文件,我会有一个更好的错误消息(例如,这个例子:"解决方案xxxx的导入失败.你的系统中缺少以下组件[...]").
有没有办法得到这个完整的信息?
这是我的代码:
try
{
_serviceProxy.Execute(impSolReq);
}
catch (Exception ex)
{
if (ex is FaultException<OrganizationServiceFault>)
MessageBox.Show("Error during import. More details: " + ((FaultException<OrganizationServiceFault>)ex).Detail);
else
MessageBox.Show("Error during import. More details: " + ex.Message);
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的回答!
我想知道如何将变量放在字符串中并使用Angular2渲染它?
这是我的代码:
HTML:
<div [innerHTML]="testHTML"></div>
Run Code Online (Sandbox Code Playgroud)
变量:
public testHTML: string = "<h1>test - {{ variable[0] }}</h1>";
Run Code Online (Sandbox Code Playgroud)
"variable"是一个字符串数组,不是null,至少包含1个值.
我得到的是:
test - {{variable [0]}}
H1渲染得很好.但是我的变量没有被插入!
我怎么解决这个问题?