小编Was*_*siF的帖子

WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 "export '??defineInjectable' was not found in '@angular/core'

I am using ng2-charts in Angular 7 app and having warning

WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 "export '??defineInjectable' was not found in '@angular/core'

error in VS Code

在此处输入图片说明

error in browser

在此处输入图片说明

What could be the reason and how to resolve it?

ng2-charts angular angular7

21
推荐指数
1
解决办法
8289
查看次数

有没有办法以原子方式更新MongoDB中的两个集合?

我收到了一些消息:

{
    messageid: ObjectId
    userid: ObjectId
    message: string
    isread: true|false
}
Run Code Online (Sandbox Code Playgroud)

以及每个用户的消息计数集合:

{
    userid: ObjectId
    total: int
    unread: int
}
Run Code Online (Sandbox Code Playgroud)

当我从"messages"集合中删除消息时,我还需要减少"counts"集合中的"total",并且有条件地(如果"messages.isread"== false)减少"未读"字段.

为此,我需要首先检索消息,检查其"isread"字段,然后更新计数.在这些操作之间有可能将消息标记为已读取,然后我将错误地减少"未读"计数.

有没有办法根据一次拍摄的其他收藏结果有条件地改变一个集合中的某些东西?

concurrency mongodb

17
推荐指数
2
解决办法
7154
查看次数

按钮高度的柔性属性混乱?

我正在使用bootstrap并使用flex进行布局.

目前按钮正在占据容器的高度.文本下面有太多的空间,我想删除i,当我向按钮添加填充时,它的大小不均匀.我试图通过线高调整大小,但我试图找到实际的解决方案和原因,为什么我有这个问题.

我在这里缺少任何与flex相关的东西,还是其他东西?任何帮助将受到高度赞赏.谢谢.

.vessel-card {
  display: flex;
  flex-direction: column;
}
.vessel-card h3 {
  margin: 0;
  padding: 20px 0;
}
.departure-card {
  display: flex;
  padding: 20px 0;
  border-top: 2px solid #888;
}
.departure-card p {
  margin-right: 10px;
}
.departure-card:last-child {
  border-bottom: 2px solid #888;
}
.departure-card .btn-explore {
  border: 1px solid #000;
  display: inline-block;
  text-transform: uppercase;
  color: #000;
  border-radius: 0;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
  <div class="row">
    <div class="col-md-4 vessel-card">
      <a href="cienfuegos-from-havana.html" class="special-departure">
        <img src="http://placehold.it/350x150">
      </a>
      <h3>Vessel: …
Run Code Online (Sandbox Code Playgroud)

html css html5 flexbox twitter-bootstrap

14
推荐指数
2
解决办法
6377
查看次数

角度5:动态组件的交换位置

我想在视图中交换动态放置的组件的位置.

即我已经动态创建了id = 1和2的组件,如图所示.

在此输入图像描述

现在我需要交换两个组件的位置但是如何?

我知道的一件事(只有理论上)是位置可以通过ViewContainerRef classvia对象内部的移动方法来改变viewContainerRef.move(componentRef.hostView, index).

我尝试了但是位置没有互换.

@ViewChild(ContainerRefDirective) location: ContainerRefDirective;

let componentFactory = this.factoryResolver.resolveComponentFactory(EntryComponent);
let componentRef = this.location.viewContainerRef.createComponent(componentFactory);

let entryComponent: EntryComponent = componentRef.instance;
// lets say counter is variable that increments its value on new component creation.
entryComponent.Id = ++counter; 

// move method is being called right after a new component is created and placed. 
//this piece of code is in the same method (that is creating the dynamic components)
this.location.viewContainerRef.move(componentRef.hostView, 1);
Run Code Online (Sandbox Code Playgroud)

我已经阅读了有关angular.io …

typescript angular angular5

12
推荐指数
2
解决办法
862
查看次数

Angular 2+:当父值更改时更新 @Input 属性

我有一个父组件和子组件,其中父组件通过 @Input 装饰器将对象传递给子组件。问题是孩子只获取一次父数据,然后在将来更改传递给孩子的父属性后,该值不会被更新。

javascript angular

11
推荐指数
2
解决办法
1万
查看次数

如何在wpf中更改按钮的内容"颜色"

<StackPanel Margin="2">
  <Button Name="btn" Click="btn_Click" Content="Load Profile Image">
    <Button.Background>
      <ImageBrush ImageSource="D:\Pictures\rectangles.jpg"></ImageBrush>
    </Button.Background>
  </Button>
</StackPanel>
Run Code Online (Sandbox Code Playgroud)

我在这里粘贴的图像几乎是黑色的,所以我想将内容颜色更改为白色,以便它应该正确显示.

我的道歉,我没有在逗号中引用标题中添加颜色,对不起我的错误.现在没关系,我想现在读者已经清楚了;)

wpf colors button

10
推荐指数
1
解决办法
1万
查看次数

如何在Angular项目中查找scss文件的css文件

我使用以下命令在 VS Code 中创建了 Angular 项目。

ng new my-app --style=scss
Run Code Online (Sandbox Code Playgroud)

通过以下github 链接

现在,使用 angular-cli 创建的每个样式表的扩展名都是 .scss 而不是 .css

现在需要检查 Sass 如何转换为 css,因为我是 Sass 新手。我在设计中遇到了一些问题,因此查看 css 文件对我来说会很好。

我在那些存在 scss 文件的文件夹中进行了搜索,但找不到 css 文件。请帮忙

更新

在此输入图像描述

看这张图片,当我使用 cli 创建组件时,它创建了 .scss 而不是 css,所以我需要查找 css 文件。

css sass angular

6
推荐指数
1
解决办法
5808
查看次数

如何在 Angular 2+ 应用程序中录制桌面屏幕

我需要通过 共享桌面屏幕Angular 6。我已经搜索了合适的包来实现此功能,但找不到。

实际上我发现了很多包,比如RecordRTCAperturescreen-capture-recorder等等。其中一些不兼容,一些文档记录不足,并且代码智能感知不可用。

请告诉我可以与Angular 6. 我正在工作的平台是Windows

screen-recording angular angular6

5
推荐指数
1
解决办法
3906
查看次数

如何使用 HTML5 WebRTC 录制和保存视频

首先运行代码片段,然后阅读说明...它将为您提供结构

我想在第二个中录制、播放和保存视频video element。我面临的问题是:流正在第一个运行video-element但无法录制和保存视频

.video {
    border: 1px solid gray;
    box-shadow: 3px 4px lightgray;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>

<div style="text-align:center">
    <h1>Welcome to WebRTC</h1>
    <video class="video" #video autoplay controls></video>
    <video class="video" style="width:360;" autoplay controls #recordedVideo></video>
    <br>
    <button class="btn btn-warning" (click)="startRecording()">Start</button>
    <button class="btn btn-warning" (click)="stopRecording()">Stop</button>
    <button class="btn btn-warning" (click)="playRecording()">Play</button>
</div>
Run Code Online (Sandbox Code Playgroud)

------------------------ 修改并解决了问题

我在这里所做的,在Luis Estevez代码中,我在方法中声明了该事件startRecording,因为当我尝试将流块推送到 blob 数组中时,它响应了一个错误:推送方法不存在,即使我在之后创建了一个对象数组我声明了一个数组。

startRecording(stream) {
    let options = { mimeType: 'video/webm' }
    this.recordedBlobs = []
    console.log(this.recordedBlobs)
    try {
      this.mediaRecorder = new MediaRecorder(stream, …
Run Code Online (Sandbox Code Playgroud)

html javascript webrtc angular angular6

5
推荐指数
1
解决办法
4324
查看次数

如何在angular 6中导入节点npm模块

我已经安装了包

npm install local-devices
Run Code Online (Sandbox Code Playgroud)

并将其导入angular.json

"scripts": [
    "./node_modules/local-devices/index.js"
]
Run Code Online (Sandbox Code Playgroud)

并宣布为global variablesrc/typings.d.ts

declare let findLocalDevices: any
Run Code Online (Sandbox Code Playgroud)

下面,package文件结构和index.jslocal-devices封装

在此处输入图片说明在此处输入图片说明

然后尝试在组件中使用它作为

console.log(findLocalDevices())
Run Code Online (Sandbox Code Playgroud)

但有错误

findLocalDevices 未定义

如何导入,请指导!!!

import npm angular angular6

5
推荐指数
1
解决办法
9724
查看次数