我正在尝试ng-multiselect-dropdown在我的 angular 应用程序中使用。
我在定义设置时收到此错误是 VSCode:
'IDropdownSettings' 仅指一种类型,但在此处用作值。ts(2693)
我已经使用导入模块npm i ng-multiselect-dropdown并在app.module.ts. 我正在按照这里的指南进行操作。
我这是我的设置在我的page.component.ts:
import { IDropdownSettings } from 'ng-multiselect-dropdown'
export class VQCComponent implements OnInit {
dropdownSettings = {};
ngOnInit() {
this.dropdownSettings:IDropdownSettings = {
singleSelection: false,
idField: 'item_id',
textField: 'item_text',
selectAllText: 'Select All',
unSelectAllText: 'Unselect All',
itemsShowLimit: 3,
allowSeachFilter: true
}
}
}
Run Code Online (Sandbox Code Playgroud)
此行上突出显示了错误:
this.dropdownSettings:IDropdownSettings = {
Run Code Online (Sandbox Code Playgroud)
是什么导致了这个错误?我遵循了指南,但似乎找不到有关此模块的任何其他文档。
我正在尝试安装熊猫,但出现此错误:
Collecting pandas
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl
Retrying (Retry(total=0, connect=None, read=None, redirect=None, …Run Code Online (Sandbox Code Playgroud) 我想做的是设置工具提示的样式,我希望能够增加字体的大小。目前我只能增加字体的大小,<div>但工具提示字体保持相同的大小。
我的 html 看起来像这样:
<div id="divId" matTooltipClass="tooltip" matTooltip="This is a tooltip." matTooltipPosition="above"></div>
Run Code Online (Sandbox Code Playgroud)
在 CSS 中我尝试使用:
::ng-deep .mat-tooltip.mat-tooltip.mat-tooltip.tooltip 以及使用!important. 这些都对工具提示的样式没有任何影响。
为什么这些解决方案都不起作用?能够设置工具提示样式的解决方案是什么?
我创建了一个 HTML 网页,它也使用 CSS 和 JS。当我在我的 PC 上查看它时,它可以工作并且看起来应该如何。
将它放在我的手机上的最佳方法是什么?我试图将所有相关文件放到我的手机上,但它只会加载基本 HTML,所有文件都在同一文件夹中,因为 HTML 代码仅引用 CSS 和 JS 的名称,因为它们在同一文件中个人电脑。
我将 CCS 引用为:<link href="style.css" rel="stylesheet" type="text/css"/>将脚本引用为<script type="text/javascript" src="script.js">
我正在使用谷歌浏览器在我的 PC 上打开 HTML,并尝试在我的手机上使用谷歌浏览器查看它。我有一部安卓手机。
提前致谢。
我试图将相同的图像加载到HTML的所有画布中。我以前用javascript编写了整个网页,但现在我正在学习角度和打字稿。
我在Visual Studio代码中突出显示了此错误:
“ HTMLElement”类型的参数不能分配给“ CanvasImageSource”类型的参数。类型“ HTMLElement”缺少类型“ HTMLVideoElement”中的以下属性:height,msHorizontalMirror,msIsLayoutOptimalForPlayback,msIsStereo3D和80个以上的属性。ts(2345)
但是我没有在控制台中显示任何错误。我可以将图像加载到画布内的HTML上(这样就可以了)。
这是我的ts:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-map',
templateUrl: './map.component.html',
styleUrls: ['./map.component.scss']
})
export class MapComponent implements OnInit {
constructor() { }
ngOnInit() {
document.querySelectorAll("canvas").forEach(c=>{
var ctx = c.getContext("2d");
var img = document.getElementById("P43");
ctx.drawImage(img,0,0,106,50); //(image, offsetx, offsety, x, y)
});
}
}
Run Code Online (Sandbox Code Playgroud)
VS Code突出显示此行中的错误ctx.drawImage(img,0,0,106,50); //(image, offsetx, offsety, x, y),突出显示img并显示错误。
我试图进行搜索,但是找到的唯一解决方案是当您具有标签的ID(页面上没有所有画布)时,或者是否有输入。
任何帮助表示赞赏。
我正在使用从服务器读取JSON的内容HttpClient。我能够成功读取一次内容,但是当我第二次读取它时,它总是返回undefined。
这是我的.ts样子:
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http'
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
name = 'Angular';
constructor(private httpService: HttpClient) { }
getData() {
this.httpService.get('https://raw.githubusercontent.com/LearnWebCode/json-example/master/animals-1.json').subscribe(
result => {
console.log(result)
}
)
}
ngOnInit() {
this.getData()
setInterval(this.getData, 10000)
}
}
Run Code Online (Sandbox Code Playgroud)
HttpClientapp.module.ts在我第一次阅读JSON时已正确导入,它可以正常工作。
这是有问题的stackBlitz。
我正在使用,setInterval因为我希望能够继续读取JSON,因为值将更新。我是否打算关闭httpClient.get请求,以便我可以提出另一个请求。
我看到了其他问题,其中请求始终返回,undefined而我的请求仅undefined在第二个请求之后返回。
每次发送get请求时,如何成功获取JSON的内容?
编辑
显然,对于我的某些stackblitz来说,这不是问题,这是来自控制台的stackblitz的屏幕截图,其中包含以下问题:

angular ×4
css ×2
html ×2
javascript ×2
android ×1
json ×1
pandas ×1
pip ×1
python ×1
typescript ×1