【问题标题】:How to get alert,confirmation boxes using angular 2如何使用 Angular 2 获得警报、确认框
【发布时间】:2017-03-16 06:42:52
【问题描述】:

我需要根据各种条件在我的项目中单击按钮时实现警报框。您能否建议我如何使用 Angular 2 实现警报框,我不需要传统的 window.alert()

【问题讨论】:

标签: angular alert popupwindow angular2-modal


【解决方案1】:

你可以使用 angular2 包

npm install ng2-modal --save

`<button (click)="myModal.open()">Show popup</button>
    <modal #myModal>
        <modal-header>
            <h1>Your header goes here</h1>
        </modal-header>
        <modal-content>
            Body goes here
        </modal-content>
        <modal-footer>
            <button class="btn btn-primary (click)="myModal.close()">Cancel</button>
        </modal-footer>
    </modal>`

更多详情:https://www.npmjs.com/package/ng2-modal

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-11
    • 1970-01-01
    • 2015-09-17
    • 1970-01-01
    • 2019-12-21
    • 1970-01-01
    • 2019-06-06
    • 2011-08-02
    相关资源
    最近更新 更多