从ngx引导程序模式服务的事件发射器获取事件

时间:2019-06-12 08:58:25

标签: angular event-handling preventdefault ngx-bootstrap ngx-bootstrap-modal

尝试从 ngx-bootstrap 获取事件,以防止在某些情况下关闭事件

提供原因但未提供事件的文档,我认为需要停止该事件吗?有一个带有事件的静态模式的例子,我需要使用模式服务来访问事件

这就是我referring to

具有event

的静态模式事件
#!/usr/bin/env python

import pymysql.cursors
from flask import Flask, request
from Crypto.Cipher import AES

connection = pymysql.connect('localhost','esp', 'password', 'points')
app = Flask(__name__)

@app.route('/post', methods = ["POST"])


def post():

    hits1 = 0
    hits2 = 0
    punch1 = 0
    punch2 = 0
    kick1 = 0
    kick2 = 0
    takedown1 = 0
    takedown2 = 0

    print(request.data)
    cipher = AES.new("abcdefghijklmnop")

    decryptedData = cipher.decrypt(request.data)


    data = decryptedData.decode("utf-8")
    print(data)

    print(data)
    if(data[:1]=="e"):
        if(data[1:2] == "1"):
            hits1+=1
            print(hits1)

    if (data[:1]=="1"):
        if(data[1:2]=="1"):
            punch1+=1
        elif(data[1:2]=="2"):
            kick1+=1
        elif(data[1:2]=="3"):
            takedown1+=1
    elif(data[:1]=="2"):
        if(data[1:2]=="1"):
            punch2+=1
        elif(data[1:2]=="2"):
            kick2+=1
        elif(data[1:2]=="3"):
            takedown2+=1
    points1 = punch1 + kick1 * 2 + takedown1 * 3
    points2 = punch2 + kick2 * 2 + takedown2 * 3
    print(points1)
    print(points2)

    try:
       with connection.cursor() as cursor:


            cursor.execute("INSERT INTO points values({0}, {1}, {2}, {3}, {4}, {5})".format(1, hits1, kick1, punch1, takedown1, points1))
            cursor.execute ("INSERT INTO points values({0}, {1}, {2}, {3}, {4}, {5})".format(2, hits2, kick2, punch2, takedown2, points2))


            connection.commit()
            print ("Data committed")
            return 'ok'
    except:
       connection.close()
app.run(host='0.0.0.0', port= 8090)

仅原因字符串,没有事件!

我认为我无法通过停止onHide事件来阻止用户关闭模式吗?

1 个答案:

答案 0 :(得分:0)

因为我这可能是ngx-bs的限制?这就是我所做的:

  

(我不认为这是我的问题的答案,而是   解决方法)

我禁用了下车解雇

ignoreBackdropClick: true, 

将关闭按钮从bsModalRef.hide()更改为我自己的功能,并使用它打开另一个带有确认问题的模式