html 元素video有一个名为的属性disablePictureInPicture,尽管它似乎只能在 chrome 中工作,但它工作得非常好。
由于我只能找到有关此问题的旧帖子,这些帖子最终没有解决或解决方法,因此我再次在这里询问。
您知道此问题的修复/解决方法吗?
所以基本上我有一个对象数组,我想通过将数组中选定对象的索引提供给另一个组件@Input。
问题是,当选择同一项目两次时,该ngOnChanges函数不会检测到更改,因为当我将值从 1 设置为 1 时,它不会将其识别为更改...这导致我无法选择同一个物体连续两次。
子组件:
@Input('editAppointmentIndex') editAppointmentIndex: number;
ngOnChanges(changes: SimpleChanges) {
console.log(changes);
if (changes.editAppointmentIndex && changes.editAppointmentIndex.currentValue != undefined) {
// Do what i want to do with the selected object
}
}
Run Code Online (Sandbox Code Playgroud)
父组件:
<child-component [editAppointmentIndex]="currentAppointmentIndex"></child-component>
Run Code Online (Sandbox Code Playgroud)
currentAppointmentIndex: number;
onEdit(i) {
this.currentAppointmentIndex = i;
}
Run Code Online (Sandbox Code Playgroud)
兄弟组件:
<button class="edit" (click)="onEdit(i)">Edit</button>
Run Code Online (Sandbox Code Playgroud)
@Output() onEdit_: EventEmitter<number> = new EventEmitter<number>();
onEdit(i) {
this.onEdit_.emit(i);
}
Run Code Online (Sandbox Code Playgroud) 我试图添加一个进度条,但有时它会出错并且填充太慢或太快,但大多数时候它工作正常。
我还认为必须有一种更好的方法来对此进行编程,因为我认为我的方法可以对单个进度条进行许多计算。
这是我的代码:
TS:
startProgressbar(timeToWait: number) {
this.progress = 0;
const interval = setInterval(() => {
let addvalue = (1 / timeToWait * 100) / 64;
this.progress += addvalue;
if (this.progress >= 100) {
this.progress = 100;
window.clearInterval(interval);
}
}, 15.625); }
Run Code Online (Sandbox Code Playgroud)
一旦结束,该函数就会再次被调用,因为紧接着就会有幻灯片的下一张幻灯片。
进度值类似于进度条的宽度,它始终是百分比。
数字 15.625 从何而来?它只是 64 秒,因此进度条每秒更新 64 次,给人一种平稳移动的错觉。
我的 html 非常基本:
<div class="progressbar" [ngStyle]="{'width': progress+'%'}"></div>
Run Code Online (Sandbox Code Playgroud)
我希望你有比我更好的方法。提前致谢
[编辑]:我所说的bug的意思是进度条有时开始填充较晚,因此在下一张幻灯片出现之前不会到达末尾(100%),然后下一张幻灯片的时间也会偏移。有时它会提前开始,然后过快地到达结尾 (100%),因此它会在 100% 状态停留一段时间,直到下一张幻灯片出现。
我创建了一个 angular 项目,出于美观的原因,我想使用字体很棒的图标。我是这样安装的:
npm install font-awesome
Run Code Online (Sandbox Code Playgroud)
然后将它添加到我的 angular.json 中的 javascript 中:
"styles": [
"node_modules/font-awesome/css/font-awesome.css"
]
Run Code Online (Sandbox Code Playgroud)
已检查,路径正确(对于我的设置)
因此,当我现在尝试添加例如“加号”图标(包含在免费版本中)时,它只是显示为一个奇怪的占位符......
我添加了这样的图标:
<i class="fas fa-plus-circle"></i>
Run Code Online (Sandbox Code Playgroud)
希望你们能帮助我
由于某种原因,我无法将数据加载到输入表单中。没有太多需要解释的,我想我只是在监督某事或做错事。
这是我的html:
<mat-form-field>
<input matInput [(ngModel)]="name" placeholder="Folienname">
</mat-form-field>
<mat-form-field>
<input matInput type="text" [(ngModel)]="text" placeholder="Nachricht">
</mat-form-field>
<mat-form-field>
<mat-select [(value)]="color" placeholder="Schriftfarbe">
<mat-option value="#ffffff">White</mat-option>
<mat-option value="#bfbfbf">Lightgrey</mat-option>
<mat-option value="#808080">Grey</mat-option>
</mat-select>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)
这是我的 ts:
export class SlideEditorComponent implements OnInit {
slides: Slide[];
name: string = '';
text: string = '';
color: string = "#000000";
constructor(
private slideService: SlideService,
private event: EventService
) {
this.event.subscribe('edit-slide-data', (slide: Slide) => {
this.updateValues(slide);
});
}
ngOnInit() {
this.slideService
.getSlides()
.subscribe((data: Slide[]) => {
this.slides = data;
})
}
onSaveSlide() …Run Code Online (Sandbox Code Playgroud)