Ionic2 / Angular2 - 隐藏从导航视图

时间:2016-05-05 18:46:04

标签: angular ionic2

我有一个模态视图,一旦点击该模态中的元素,它就会进入导航视图(通常会出现一个后退按钮)。问题是,当你从导航回弹到模态时,除了我已经在模态上的关闭按钮之外,还会出现一个新的后退按钮(这是我要隐藏的按钮)。

关于如何隐藏模态中的后退按钮的任何想法?

2 个答案:

答案 0 :(得分:3)

尝试使用 hideBackButton 指令

import os
import random
import string
import time

def secret_key_gen(path, max_age=86400):
    """
    Try to load the SECRET_KEY from SECRET_FILE. 
    If that fails, then generate random SECRET_KEY 
    and save it into our SECRET_FILE for future loading. 
    If everything fails, then just raise an exception.

    Given the app is running by a user with with sufficient rights 
    to write into app directory, key file will be auto-generated 
    the first time it's been looked for. 
    """

    SECRET_FILE = os.path.join(path, 'SECURITY_HASH')
    try:       
        last_modified = os.stat(SECRET_FILE).st_mtime
        lifespan = (time.time() - last_modified)

        # update key if file age is older than allowed
        if lifespan > max_age: 
            raise IOError

        SECRET_KEY = open(SECRET_FILE).read().strip()
    except (OSError, IOError):
        try:
            l = lambda _: random.SystemRandom().choice(string.printable)
            SECRET_KEY = ''.join(map(l, range(32)))
            with open(SECRET_FILE, 'w') as f:
                f.write(SECRET_KEY)
        except IOError:
            raise Exception('Cannot open file `%s` for writing.' % SECRET_FILE)
    return SECRET_KEY

# usage
SECURITY_HASH = secret_key_gen(
    path=os.path.dirname(__file__),
    max_age=60 * 60 * 24)

答案 1 :(得分:0)

如果您还没有看到this document on ionic modals看一看。如果您已经有后退按钮,则应该能够删除随附的关闭/返回按钮。确保你的模态模板中没有这个:

<button (click)="close()">Close</button>