小编Sha*_*mal的帖子

ngx-webcam用于特定视图和组件角度6

我在我的应用程序中使用ngx-webcam来使用网络摄像头捕获图像.我在app.module.ts中有导入库,也在我的视图中,但它给了我这个错误'webcam'不是一个已知的元素.如果在app.component html中使用网络摄像头标签,它工作正常,但我想在单独的视图中使用它.这是我的代码

import {WebcamImage} from 'ngx-webcam';

export class CreateMemberComponent implements OnInit {
 private trigger: Subject<void> = new Subject<void>();

 // latest snapshot
 public webcamImage: WebcamImage = null;
public triggerSnapshot(): void {
    this.seconds = 3;
    this.trigger.next();
    this.seconds = null;
  }

  public handleImage(webcamImage: WebcamImage): void {
    console.log('received webcam image', webcamImage);
    this.webcamImage = webcamImage;
  }

  public get triggerObservable(): Observable<void> {
    return this.trigger.asObservable();
  }
Run Code Online (Sandbox Code Playgroud)

这是我的HTML代码

<div class="col-sm-4">
    <div style="text-align:center">
        <div>
          <p>{{seconds}}</p>
          <webcam [trigger]="triggerObservable" (imageCapture)="handleImage($event)"></webcam>
          <br/>
          <button id="snapshotBtn" (click)="triggerSnapshot();">Take A Snapshot</button>
        </div>
      </div>
      <div class="snapshot" *ngIf="webcamImage"> …
Run Code Online (Sandbox Code Playgroud)

angular5 angular6

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

方法接受三个布尔参数并在这些布尔值C#的基础上返回字符串

我带来了一个方法,它接受三个bool参数并返回一个字符串值.例如,我在表列中保存0,1,2.我有三个布尔变量isView,isAddUpdateisDelete.当isViewtrue然后保存只有0,如果isViewisAddUpdate是真正的比节省0.1,如果所有的人都为真比保存0,1,2.

这是我的代码.请建议我更好的方法来实现这一目标.

public string getActions(bool isView, bool isAddupdate, bool isDelete)
{
    try
    {
        var _val = "";
        if (isView && isAddupdate && isDelete)
            _val = "0,1,2";
        if (isView && isAddupdate && !isDelete)
            _val = "0,1";
        if (isView && !isAddupdate && !isDelete)
            _val = "0";
        if (!isView && !isAddupdate && !isDelete)
            _val = "";
        if (!isView && !isAddupdate && isDelete)
            _val = "2";
        if (!isView && isAddupdate …
Run Code Online (Sandbox Code Playgroud)

c#

-3
推荐指数
1
解决办法
86
查看次数

标签 统计

angular5 ×1

angular6 ×1

c# ×1