Angular 2 - window 点击按钮后带有 PIN 码

Angular 2 - window with pin number after clicking button

我想在单击按钮后创建带有 PIN 码的弹出窗口 window。输入密码后 json 如果正确输入密码,数据将发送到数据库。

这是我的一些代码:

锁定-status.component.html

<button type="button" (click)="addLog($event)" class="btn btn-success btn-open">OPEN DOORS <i class="fa fa-key fa-3x"></i></button>

锁定-status.component.ts

import { Component, OnInit } from '@angular/core';
import {LogService} from '../../services/log.service';
import 'rxjs/add/operator/map';
import {Log} from '../../Log';

@Component({
    moduleId: module.id,
    selector: 'lock-status',
    templateUrl: 'lock-status.component.html'
})
export class LockStatusComponent implements OnInit {
    logs: Log[];

    constructor(private _logService:LogService) { }

    ngOnInit(){
    this.logs = [];
    this._logService.getLogs()
      .map(res => res.json())
      .subscribe(logs => this.logs = logs);
    }

    addLog($event){
        if($event.which === 1){
            var result;
            var d=new Date();
            var newLog={
                datka: String(d),
                isCompleted: true
            };

            result=this._logService.saveLog(newLog);
            result.subscribe(x =>{this.logs.push(newLog)})
        }
    }

 }

你知道我该怎么做吗?

看看这个库 ng2-bs3-modal 中的模态弹出窗口 windows。您在单击按钮时弹出 window,出示图钉或请求图钉,然后在 ok/confirm 按钮上执行您的逻辑,然后导航到您需要的位置。