2017-03-16 73 views
1

我有一个要求,在我的项目中实施警报框,单击一个按钮取决于各种条件。能否请你建议我如何使用角2实施警告框,我不需要传统window.alert()如何获得警报,使用角度确认框2

+0

看一看:https://github.com/valor-software/ng2-bootstrap – pixelbits

+0

我们可以让它不使用引导 – thecrusader

+0

有没有办法让一个$ window.alert? – Steve

回答

1

您可以使用angular2包

NPM的安装NG2模态--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