2017-03-16 49 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